repo_name stringlengths 4 116 | path stringlengths 4 379 | size stringlengths 1 7 | content stringlengths 3 1.05M | license stringclasses 15
values |
|---|---|---|---|---|
Xervmon/b2b | components/com_xipt/libraries/acl/invitefriend/invitefriend.php | 584 | <?php
/**
* @Copyright Ready Bytes Software Labs Pvt. Ltd. (C) 2010- author-Team Joomlaxi
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
**/
// no direct access
if(!defined('_JEXEC')) die('Restricted access');
class invitefriend extends XiptAclBase
{
function getResourceOwner($data)
{
return $data['userid'];
}
function checkAclApplicable(&$data)
{
if('com_community' != $data['option'] && 'community' != $data['option'])
return false;
if('friends' != $data['view'])
return false;
if($data['task'] === 'invite')
return true;
return false;
}
} | gpl-2.0 |
a-rodin/qstardict | translations/qstardict-ru_RU.ts | 30820 | <?xml version="1.0" ?><!DOCTYPE TS><TS language="ru_RU" version="2.1">
<context>
<name>AddDictionaryDialog</name>
<message>
<source>Add dictionary</source>
<translation>Добавить словарь</translation>
</message>
<message>
<source>Name:</source>
<translation>Название:</translation>
</message>
<message>
<source>Author:</source>
<translation>Автор:</translation>
</message>
<message>
<source>Description:</source>
<translation>Описание:</translation>
</message>
<message>
<source>HTTP query:</source>
<translation>HTTP запрос:</translation>
</message>
<message>
<source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The '%s' template will be replace to word.</p></body></html></source>
<translation><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Шаблон '%s' будет заменен на слово.</p></body></html></translation>
</message>
<message>
<source>HTML charset:</source>
<translation>Кодировка HTML:</translation>
</message>
</context>
<context>
<name>Anki</name>
<message>
<source>Add word to &Anki</source>
<translation>Добавить слово в &Anki</translation>
</message>
<message>
<source>Anki error</source>
<translation>Ошибка Anki</translation>
</message>
<message>
<source>Unable to add the word to Anki: network error. <br>Check if Anki is running and <a href="https://ankiweb.net/shared/info/2055492159">AnkiConnect</a> add-on is installed to Anki. You probably would like to also install <a href="https://ankiweb.net/shared/info/85158043">Minimize to tray</a> add-on to Anki.</source>
<translation>Не удалось добавить слово в Anki: ошибка сети. <br>Проверьте, что приложение Anki запущено и дополнение <a href="https://ankiweb.net/shared/info/2055492159">AnkiConnect</a> установлено в Anki. Вам, вероятно, также захочется установить дополнение <a href="https://ankiweb.net/shared/info/85158043">Minimize to tray</a> в Anki.</translation>
</message>
</context>
<context>
<name>DictBrowserSearch</name>
<message>
<source>Search:</source>
<translation>Поиск:</translation>
</message>
<message>
<source>Case sensitive</source>
<translation>Учитывать регистр</translation>
</message>
<message>
<source>Whole words</source>
<translation>Слова целиком</translation>
</message>
</context>
<context>
<name>Print</name>
<message>
<source>Prin&t translation</source>
<translation>На&печатать перевод</translation>
</message>
</context>
<context>
<name>QStarDict::CSSEdit</name>
<message>
<source>Preview</source>
<translation>Предварительный просмотр</translation>
</message>
<message>
<source>Element</source>
<translation>Элемент</translation>
</message>
<message>
<source>Foreground</source>
<translation>Цвет шрифта</translation>
</message>
<message>
<source>Background</source>
<translation>Цвет фона</translation>
</message>
<message>
<source>Select element</source>
<translation>Выберите элемент</translation>
</message>
<message>
<source>Click to select color</source>
<translation>Нажмите чтобы выбрать элемент</translation>
</message>
<message>
<source>#000000</source>
<translation>#000000</translation>
</message>
<message>
<source>Font</source>
<translation>Шрифт</translation>
</message>
<message>
<source>Size</source>
<translation>Размер</translation>
</message>
<message>
<source>Select font</source>
<translation>Выберите шрифт</translation>
</message>
<message>
<source>Select font size</source>
<translation>Выберите размер шрифта</translation>
</message>
<message>
<source>pt</source>
<translation>пт</translation>
</message>
<message>
<source>Bold</source>
<translation>Жирный</translation>
</message>
<message>
<source>B</source>
<translation>Ж</translation>
</message>
<message>
<source>Italic</source>
<translation>Курсив</translation>
</message>
<message>
<source>I</source>
<translation>К</translation>
</message>
<message>
<source>Underline</source>
<translation>Подчеркнутый</translation>
</message>
<message>
<source>U</source>
<translation>П</translation>
</message>
</context>
<context>
<name>QStarDict::DictBrowser</name>
<message>
<source>The word <b>%1</b> is not found.</source>
<translation>Слово <b>%1</b> не найдено.</translation>
</message>
</context>
<context>
<name>QStarDict::DictWidget</name>
<message>
<source>Go to &previous translation</source>
<translation>Перейти к &предыдущему переводу</translation>
</message>
<message>
<source>Go to &next translation</source>
<translation>Перейти к &следующему переводу</translation>
</message>
<message>
<source>Speak &word</source>
<translation>П&роизнести слово</translation>
</message>
<message>
<source>Search</source>
<translation>Поиск</translation>
</message>
</context>
<context>
<name>QStarDict::KDEIntegration</name>
<message>
<source>scanning is %1</source>
<translation>сканирование %1</translation>
</message>
<message>
<source>enabled</source>
<translation>включено</translation>
</message>
<message>
<source>disabled</source>
<translation>выключено</translation>
</message>
</context>
<context>
<name>QStarDict::MainWindow</name>
<message>
<source>QStarDict</source>
<translation>QStarDict</translation>
</message>
<message>
<source>Clear the search box</source>
<translation>Очистить строку поиска</translation>
</message>
<message>
<source>Clear</source>
<translation>Очистить</translation>
</message>
<message>
<source>Fuzzy query</source>
<translation>Неточный запрос</translation>
</message>
<message>
<source>Search</source>
<translation>Поиск</translation>
</message>
<message>
<source>Words list</source>
<translation>Список слов</translation>
</message>
<message>
<source>&File</source>
<translation>&Файл</translation>
</message>
<message>
<source>&Help</source>
<translation>&Справка</translation>
</message>
<message>
<source>&Settings</source>
<translation>&Настройки</translation>
</message>
<message>
<source>&Quit</source>
<translation>&Выход</translation>
</message>
<message>
<source>Ctrl+Q</source>
<translation>Ctrl+Q</translation>
</message>
<message>
<source>&About</source>
<translation>&О программе QStarDict</translation>
</message>
<message>
<source>About &Qt</source>
<translation>О &библиотеке Qt</translation>
</message>
<message>
<source>&Configure QStarDict</source>
<translation>&Конфигурация</translation>
</message>
<message>
<source>&Scan</source>
<translation>&Сканировать</translation>
</message>
<message>
<source>QStarDict &Help</source>
<translation>&Справка по QStarDict</translation>
</message>
<message>
<source>F1</source>
<translation>F1</translation>
</message>
<message>
<source>Ctrl+T</source>
<translation>Ctrl+T</translation>
</message>
<message>
<source>About QStarDict</source>
<translation>О программе QStarDict</translation>
</message>
<message>
<source><b>QStarDict %1 </b> - Qt version of StarDict<br></source>
<translation><b>QStarDict %1 </b> - Qt-версия программы StarDict<br></translation>
</message>
<message>
<source>Copyright (C) 2007-2009 Alexander Rodin <a href="http://qstardict.ylsoftware.com">http://qstardict.ylsoftware.com</a></source>
<translation>Copyright (C) 2007-2009 Александр Родин <a href="http://qstardict.ylsoftware.com">http://qstardict.ylsoftware.com</a></translation>
</message>
<message>
<source>%1 - QStarDict</source>
<translation>%1 - QStarDict</translation>
</message>
</context>
<context>
<name>QStarDict::PluginsModel</name>
<message>
<source><b>Filename:</b> %1</source>
<translation><b>Имя файла:</b> %1</translation>
</message>
<message>
<source><b>Status:</b> %1</source>
<translation><b>Статус:</b> %1</translation>
</message>
<message>
<source>Loaded</source>
<translation>Загружен</translation>
</message>
<message>
<source>Not Loaded</source>
<translation>Не загружен</translation>
</message>
<message>
<source>Invalid</source>
<translation>Несовместимый</translation>
</message>
</context>
<context>
<name>QStarDict::SettingsDialog</name>
<message>
<source>QStarDict Settings</source>
<translation>Настройки QStarDict</translation>
</message>
<message>
<source>Global settings</source>
<translation>Общие настройки</translation>
</message>
<message>
<source>Run in background</source>
<translation>Работать в фоне</translation>
</message>
<message>
<source>Start with system</source>
<translation>Запускать вместе с системой</translation>
</message>
<message>
<source>Instant search</source>
<translation>Поиск при наборе</translation>
</message>
<message>
<source>Pronounce words using this command:</source>
<translation>Произносить слова, используя команду:</translation>
</message>
<message>
<source>Enter cmd for the speaching program.<br>If cmd contains "%s" it will be replaced to word, else word will be written to stdin of speech process.</source>
<translation>Введите команду для запуска программы.<br>Если команда содержит выражение "%s", оно будет заменено на слово; иначе слово будет записано в стандартный поток ввода процесса.</translation>
</message>
<message>
<source>Dictionaries</source>
<translation>Словари</translation>
</message>
<message>
<source>Move up</source>
<translation>Переместить вверх</translation>
</message>
<message>
<source>Up</source>
<translation>Вверх</translation>
</message>
<message>
<source>Move down</source>
<translation>Переместить вниз</translation>
</message>
<message>
<source>Down</source>
<translation>Вниз</translation>
</message>
<message>
<source>Show information about dictionary</source>
<translation>Показать информацию о словаре</translation>
</message>
<message>
<source>Show info</source>
<translation>Показывать информацию</translation>
</message>
<message>
<source>Plugins</source>
<translation>Плагины</translation>
</message>
<message>
<source>Popup window</source>
<translation>Всплывающее окно</translation>
</message>
<message>
<source>Behavior</source>
<translation>Поведение</translation>
</message>
<message>
<source>Show translation popup by shortcut</source>
<translation>Показывать всплывающее окно по горячей клавише</translation>
</message>
<message>
<source>Pronounce the word</source>
<translation>Произносить слово</translation>
</message>
<message>
<source>Timeout before hide after mouse over</source>
<translation>Задержка перед скрытием после отведения указателя мыши</translation>
</message>
<message>
<source>Don't hide</source>
<translation>Не скрывать</translation>
</message>
<message>
<source> sec</source>
<translation>сек</translation>
</message>
<message>
<source>Show only if modifier is pressed</source>
<translation>Показывать только если нажата клавиша-модификатор</translation>
</message>
<message>
<source>Alt</source>
<translation>Alt</translation>
</message>
<message>
<source>Control</source>
<translation>Control</translation>
</message>
<message>
<source>Shift</source>
<translation>Shift</translation>
</message>
<message>
<source>Win</source>
<translation>Win</translation>
</message>
<message>
<source>Scan selection</source>
<translation>Сканировать выделение</translation>
</message>
<message>
<source>Show if word not found</source>
<translation>Показывать если слово не найдено</translation>
</message>
<message>
<source>Appearance</source>
<translation>Внешний вид</translation>
</message>
<message>
<source>Opacity</source>
<translation>Непрозрачность</translation>
</message>
<message>
<source>%</source>
<translation>%</translation>
</message>
<message>
<source>Default width</source>
<translation>Ширина по умолчанию</translation>
</message>
<message>
<source>Default height</source>
<translation>Высота по умолчанию</translation>
</message>
<message>
<source>Misc</source>
<translation>Прочее</translation>
</message>
<message>
<source>Other Plugins</source>
<translation>Другие плагины</translation>
</message>
<message>
<source>Enabled</source>
<translation>Включен</translation>
</message>
<message>
<source>Name</source>
<translation>Название</translation>
</message>
<message>
<source>Plugin</source>
<translation>Плагин</translation>
</message>
<message>
<source>All translation</source>
<translation>Весь перевод</translation>
</message>
<message>
<source>Dictionary name</source>
<translation>Название словаря</translation>
</message>
<message>
<source>Title</source>
<translation>Заголовок</translation>
</message>
<message>
<source>Explanation</source>
<translation>Пояснение</translation>
</message>
<message>
<source>Abbreviation</source>
<translation>Аббревиатура</translation>
</message>
<message>
<source>Example</source>
<translation>Пример употребления слова</translation>
</message>
<message>
<source>Transcription</source>
<translation>Транскрипция</translation>
</message>
<message>
<source>Information about dictionary "%1"</source>
<translation>Информация о словаре "%1"</translation>
</message>
<message>
<source><b>Name:</b> %1<br></source>
<translation><b>Название:</b> %1<br></translation>
</message>
<message>
<source><b>Plugin:</b> %1<br></source>
<translation><b>Плагин:</b> %1<br></translation>
</message>
<message>
<source><b>Author:</b> %1<br></source>
<translation><b>Автор:</b> %1<br></translation>
</message>
<message>
<source><b>Words count:</b> %1<br></source>
<translation><b>Количество слов:</b> %1<br></translation>
</message>
<message>
<source>unknown</source>
<translation>неизвестно</translation>
</message>
<message>
<source><b>Description:</b> %1</source>
<translation><b>Описание:</b> %1</translation>
</message>
<message>
<source>Information about %1 plugin</source>
<translation>Информация о плагине %1</translation>
</message>
<message>
<source><b>Version:</b> %1<br></source>
<translation><b>Версия:</b> %1<br></translation>
</message>
<message>
<source><b>Authors:</b> %1<br></source>
<translation><b>Авторы:</b> %1<br></translation>
</message>
<message>
<source><br></source>
<translation><br></translation>
</message>
<message>
<source><b>Can search similar words:</b>%1<br></source>
<translation><b>Поиск похожих слов:</b>%1<br></translation>
</message>
<message>
<source>yes</source>
<translation>есть</translation>
</message>
<message>
<source>no</source>
<translation>нет</translation>
</message>
</context>
<context>
<name>QStarDict::TrayIcon</name>
<message>
<source>QStarDict</source>
<translation>QStarDict</translation>
</message>
<message>
<source>&Scan</source>
<translation>&Сканировать</translation>
</message>
<message>
<source>&Configure QStarDict</source>
<translation>&Конфигурация</translation>
</message>
</context>
<context>
<name>QStarDict::TrayIconDefaultImpl</name>
<message>
<source>Show &main window</source>
<translation>Показать &главное окно</translation>
</message>
<message>
<source>&Quit</source>
<translation>&Выход</translation>
</message>
<message>
<source>QStarDict: scanning is %1</source>
<translation>QStarDict: сканирование %1</translation>
</message>
<message>
<source>enabled</source>
<translation>включено</translation>
</message>
<message>
<source>disabled</source>
<translation>выключено</translation>
</message>
</context>
<context>
<name>SaveToFile</name>
<message>
<source>&Save translation</source>
<translation>&Сохранить перевод</translation>
</message>
<message>
<source>Text files (*.txt)</source>
<translation>Тестовые файлы (*.txt)</translation>
</message>
<message>
<source>Save translation</source>
<translation>Сохранить перевод</translation>
</message>
<message>
<source>HTML files (*.html *.htm)</source>
<translation>Файлы HTML (*.html *.htm)</translation>
</message>
<message>
<source>HTML files (*.html, *.htm)</source>
<translation>Файлы HTML (*.html, *.htm)</translation>
</message>
<message>
<source>Error</source>
<translation>Ошибка</translation>
</message>
<message>
<source>Cannot save translation as %1</source>
<translation>Не удалось сохранить перевод %1</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
<message>
<source>StarDict plugin settings</source>
<translation>Настройки плагина StarDict</translation>
</message>
<message>
<source>Translations</source>
<translation>Переводы</translation>
</message>
<message>
<source>If enabled, all lists in translation will be formatted using HTML <li> tag (may be slow)</source>
<translation>Если включено, все переводы будут отформатированы с использованием HTML <li> тега (может быть медленным)</translation>
</message>
<message>
<source>Reformat lists</source>
<translation>Переформатировать списки</translation>
</message>
<message>
<source>Expand abbreviations if dictionary contains it (may be slow)</source>
<translation>Раскрывать сокращения, если словарь содежит их (может быть медленным)</translation>
</message>
<message>
<source>Expand abbreviations</source>
<translation>Раскрывать сокращения</translation>
</message>
<message>
<source><b><font color="red">Warning!</font></b> Reformatted translations may display incorrectly.</source>
<translation><b><font color="red">Внимание!</font></b> Переформатированные переводы могут отображаться некорректно.</translation>
</message>
<message>
<source>Data directories</source>
<translation>Директории с данными</translation>
</message>
<message>
<source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Add directory</p></body></html></source>
<translation><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Добавить директорию</p></body></html></translation>
</message>
<message>
<source>Add</source>
<translation>Добавить</translation>
</message>
<message>
<source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Remove directory</p></body></html></source>
<translation><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Удалить директорию</p></body></html></translation>
</message>
<message>
<source>Remove</source>
<translation>Удалить</translation>
</message>
<message>
<source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Move up</p></body></html></source>
<translation><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Переместить вверх</p></body></html></translation>
</message>
<message>
<source>Up</source>
<translation>Вверх</translation>
</message>
<message>
<source><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Move down</p></body></html></source>
<translation><html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Переместить вниз</p></body></html></translation>
</message>
<message>
<source>Down</source>
<translation>Вниз</translation>
</message>
<message>
<source>Select dictionaries directory</source>
<translation>Выберите директорию со словарями</translation>
</message>
<message>
<source>Anki plugin settings</source>
<translation>Настройки плагина Anki</translation>
</message>
<message>
<source>Anki Connect URL</source>
<translation>URL для Anki Connect</translation>
</message>
<message>
<source>Deck name</source>
<translation>Название колоды</translation>
</message>
<message>
<source>Model name</source>
<translation>Название модели</translation>
</message>
<message>
<source>Allow duplicates</source>
<translation>Разрешить повторения</translation>
</message>
<message>
<source>Web plugin settings</source>
<translation>Настройки плагина Web</translation>
</message>
<message>
<source>Dictionaries</source>
<translation>Словари</translation>
</message>
<message>
<source>Edit dictionary</source>
<translation>Изменить словарь</translation>
</message>
<message>
<source>Edit</source>
<translation>Изменить</translation>
</message>
<message>
<source>Add dictionary</source>
<translation>Добавить словарь</translation>
</message>
<message>
<source>Remove dictionary</source>
<translation>Удалить словарь</translation>
</message>
</context>
</TS> | gpl-2.0 |
hubzero/hubzero-cms | core/migrations/Migration20130924000003ComBanners.php | 14559 | <?php
/**
* @package hubzero-cms
* @copyright Copyright (c) 2005-2020 The Regents of the University of California.
* @license http://opensource.org/licenses/MIT MIT
*/
use Hubzero\Content\Migration\Base;
// No direct access
defined('_HZEXEC_') or die();
/**
* Migration script for joomla banner tables
**/
class Migration20130924000003ComBanners extends Base
{
/**
* Up
**/
public function up()
{
if ($this->db->tableExists('#__banner') && !$this->db->tableExists('#__banners'))
{
$query = "ALTER TABLE `#__banner` RENAME TO `#__banners`;";
$query .= "ALTER TABLE `#__banners` ENGINE = MYISAM;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableExists('#__banners'))
{
if ($this->db->tableHasField('#__banners', 'bid') && !$this->db->tableHasField('#__banners', 'id'))
{
$query = "ALTER TABLE `#__banners` CHANGE COLUMN `bid` `id` INTEGER NOT NULL auto_increment;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'alias'))
{
$query = "ALTER TABLE `#__banners` CHANGE COLUMN `alias` `alias` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL DEFAULT '';";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'checked_out'))
{
$query = "ALTER TABLE `#__banners` CHANGE COLUMN `checked_out` `checked_out` INT(10) UNSIGNED NOT NULL DEFAULT '0';";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'type'))
{
$query = "ALTER TABLE `#__banners` MODIFY COLUMN `type` INTEGER NOT NULL DEFAULT '0';";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'showBanner') && !$this->db->tableHasField('#__banners', 'state'))
{
$query = "ALTER TABLE `#__banners` CHANGE COLUMN `showBanner` `state` TINYINT(3) NOT NULL DEFAULT '0';";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'tags') && !$this->db->tableHasField('#__banners', 'metakey'))
{
$query = "ALTER TABLE `#__banners` CHANGE COLUMN `tags` `metakey` TEXT NOT NULL AFTER `state`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'date') && !$this->db->tableHasField('#__banners', 'created'))
{
$query = "ALTER TABLE `#__banners` CHANGE COLUMN `date` `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `params`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'editor'))
{
$query = "ALTER TABLE `#__banners` DROP COLUMN `editor`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'catid'))
{
$query = "ALTER TABLE `#__banners` MODIFY COLUMN `catid` INTEGER UNSIGNED NOT NULL DEFAULT 0 AFTER `state`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'description') && $this->db->tableHasField('#__banners', 'catid'))
{
$query = "ALTER TABLE `#__banners` MODIFY COLUMN `description` TEXT NOT NULL AFTER `catid`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'custombannercode') && $this->db->tableHasField('#__banners', 'description'))
{
$query = "ALTER TABLE `#__banners` CHANGE COLUMN `custombannercode` `custombannercode` VARCHAR(2048) NOT NULL AFTER `description`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'sticky') && $this->db->tableHasField('#__banners', 'description'))
{
$query = "ALTER TABLE `#__banners` MODIFY COLUMN `sticky` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `description`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'custombannercode') && $this->db->tableHasField('#__banners', 'description'))
{
$query = "ALTER TABLE `#__banners` CHANGE COLUMN `custombannercode` `custombannercode` VARCHAR(2048) NOT NULL AFTER `description`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'ordering') && $this->db->tableHasField('#__banners', 'sticky'))
{
$query = "ALTER TABLE `#__banners` MODIFY COLUMN `ordering` INTEGER NOT NULL DEFAULT 0 AFTER `sticky`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'params') && $this->db->tableHasField('#__banners', 'metakey'))
{
$query = "ALTER TABLE `#__banners` MODIFY COLUMN `params` TEXT NOT NULL AFTER `metakey`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banners', 'own_prefix') && $this->db->tableHasField('#__banners', 'params'))
{
$query = "ALTER TABLE `#__banners` ADD COLUMN `own_prefix` TINYINT(1) NOT NULL DEFAULT '0' AFTER `params`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banners', 'metakey_prefix') && $this->db->tableHasField('#__banners', 'own_prefix'))
{
$query = "ALTER TABLE `#__banners` ADD COLUMN `metakey_prefix` VARCHAR(255) NOT NULL DEFAULT '' AFTER `own_prefix`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banners', 'purchase_type') && $this->db->tableHasField('#__banners', 'metakey_prefix'))
{
$query = "ALTER TABLE `#__banners` ADD COLUMN `purchase_type` TINYINT NOT NULL DEFAULT '-1' AFTER `metakey_prefix`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banners', 'track_clicks') && $this->db->tableHasField('#__banners', 'purchase_type'))
{
$query = "ALTER TABLE `#__banners` ADD COLUMN `track_clicks` TINYINT NOT NULL DEFAULT '-1' AFTER `purchase_type`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banners', 'track_impressions') && $this->db->tableHasField('#__banners', 'track_clicks'))
{
$query = "ALTER TABLE `#__banners` ADD COLUMN `track_impressions` TINYINT NOT NULL DEFAULT '-1' AFTER `track_clicks`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banners', 'reset') && $this->db->tableHasField('#__banners', 'publish_down'))
{
$query = "ALTER TABLE `#__banners` ADD COLUMN `reset` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `publish_down`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banners', 'language') && $this->db->tableHasField('#__banners', 'created'))
{
$query = "ALTER TABLE `#__banners` ADD COLUMN `language` char(7) NOT NULL DEFAULT '' AFTER `created`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'type') && $this->db->tableHasField('#__banners', 'custombannercode'))
{
$query = "UPDATE `#__banners` SET `type`=1 WHERE TRIM(`custombannercode`)!='';";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banners', 'imageurl'))
{
$query = "ALTER TABLE `#__banners` DROP COLUMN `imageurl`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasKey('#__banners', 'viewbanner'))
{
$query = "ALTER TABLE `#__banners` DROP INDEX `viewbanner`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banners', 'idx_own_prefix'))
{
$query = "ALTER TABLE `#__banners` ADD INDEX `idx_own_prefix` (`own_prefix`);";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banners', 'idx_metakey_prefix'))
{
$query = "ALTER TABLE `#__banners` ADD INDEX `idx_metakey_prefix` (`metakey_prefix`);";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banners', 'idx_language'))
{
$query = "ALTER TABLE `#__banners` ADD INDEX `idx_language` (`language`);";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banners', 'idx_state'))
{
$query = "ALTER TABLE `#__banners` ADD INDEX `idx_state` (`state` ASC);";
$this->db->setQuery($query);
$this->db->query();
}
}
if ($this->db->tableExists('#__bannerclient') && !$this->db->tableExists('#__banner_clients'))
{
$query = "ALTER TABLE `#__bannerclient` RENAME TO `#__banner_clients`;";
$query .= "ALTER TABLE `#__banner_clients` ENGINE = MYISAM;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableExists('#__banner_clients'))
{
if ($this->db->tableHasField('#__banner_clients', 'cid') && !$this->db->tableHasField('#__banner_clients', 'id'))
{
$query = "ALTER TABLE `#__banner_clients` CHANGE COLUMN `cid` `id` INTEGER NOT NULL auto_increment;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banner_clients', 'checked_out'))
{
$query = "ALTER TABLE `#__banner_clients` CHANGE COLUMN `checked_out` `checked_out` INT(10) UNSIGNED NOT NULL DEFAULT '0';";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banner_clients', 'checked_out_time'))
{
$query = "ALTER TABLE `#__banner_clients` CHANGE COLUMN `checked_out_time` `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banner_clients', 'editor'))
{
$query = "ALTER TABLE `#__banner_clients` DROP COLUMN `editor`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banner_clients', 'state'))
{
$query = "ALTER TABLE `#__banner_clients` ADD COLUMN `state` TINYINT(3) NOT NULL DEFAULT '0' AFTER `extrainfo`;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banner_clients', 'metakey'))
{
$query = "ALTER TABLE `#__banner_clients` ADD COLUMN `metakey` TEXT NOT NULL;";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banner_clients', 'own_prefix'))
{
$query = "ALTER TABLE `#__banner_clients` ADD COLUMN `own_prefix` TINYINT NOT NULL DEFAULT '0';";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banner_clients', 'metakey_prefix'))
{
$query = "ALTER TABLE `#__banner_clients` ADD COLUMN `metakey_prefix` VARCHAR(255) NOT NULL DEFAULT '';";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banner_clients', 'purchase_type'))
{
$query = "ALTER TABLE `#__banner_clients` ADD COLUMN `purchase_type` TINYINT NOT NULL DEFAULT '-1';";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banner_clients', 'track_clicks'))
{
$query = "ALTER TABLE `#__banner_clients` ADD COLUMN `track_clicks` TINYINT NOT NULL DEFAULT '-1';";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasField('#__banner_clients', 'track_impressions'))
{
$query = "ALTER TABLE `#__banner_clients` ADD COLUMN `track_impressions` TINYINT NOT NULL DEFAULT '-1';";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banner_clients', 'idx_own_prefix'))
{
$query = "ALTER TABLE `#__banner_clients` ADD INDEX `idx_own_prefix` (`own_prefix`);";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banner_clients', 'idx_metakey_prefix'))
{
$query = "ALTER TABLE `#__banner_clients` ADD INDEX `idx_metakey_prefix` (`metakey_prefix`);";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banner_clients', 'state'))
{
$query = "UPDATE `#__banner_clients` SET `state`=1;";
$this->db->setQuery($query);
$this->db->query();
}
}
if ($this->db->tableExists('#__bannertrack') && !$this->db->tableExists('#__banner_tracks'))
{
$query = "ALTER TABLE `#__bannertrack` RENAME TO `#__banner_tracks`;";
$query .= "ALTER TABLE `#__banner_tracks` ENGINE = MYISAM;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableExists('#__banner_tracks'))
{
if (!$this->db->tableHasField('#__banner_tracks', 'count'))
{
$query = "ALTER TABLE `#__banner_tracks` ADD COLUMN `count` INTEGER UNSIGNED NOT NULL DEFAULT '0';";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableExists('#__banner_tracks'))
{
$query = "INSERT `#__banner_tracks`
SELECT `track_date`,`track_type`,`banner_id`,count('*') AS `count`
FROM `#__banner_tracks`
GROUP BY `track_date`,`track_type`,`banner_id`;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableExists('#__banner_tracks'))
{
$query = "DELETE FROM `#__banner_tracks` WHERE `count`=0;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableHasField('#__banner_tracks', 'track_date'))
{
$query = "ALTER TABLE `#__banner_tracks` CHANGE COLUMN `track_date` `track_date` DATETIME NOT NULL;";
$this->db->setQuery($query);
$this->db->query();
}
if ($this->db->tableExists('#__banner_tracks') && !$this->db->tableHasKey('#__banner_tracks', 'PRIMARY'))
{
$query = "ALTER TABLE `#__banner_tracks` ADD PRIMARY KEY (`track_date`, `track_type`, `banner_id`);";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banner_tracks', 'idx_track_date'))
{
$query = "ALTER TABLE `#__banner_tracks` ADD INDEX `idx_track_date` (`track_date`);";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banner_tracks', 'idx_track_type'))
{
$query = "ALTER TABLE `#__banner_tracks` ADD INDEX `idx_track_type` (`track_type`);";
$this->db->setQuery($query);
$this->db->query();
}
if (!$this->db->tableHasKey('#__banner_tracks', 'idx_banner_id'))
{
$query = "ALTER TABLE `#__banner_tracks` ADD INDEX `idx_banner_id` (`banner_id`);";
$this->db->setQuery($query);
$this->db->query();
}
}
}
}
| gpl-2.0 |
Nilaksha/sep_2013 | administrator/components/com_newsfeeds/views/newsfeeds/view.html.php | 4813 | <?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View class for a list of newsfeeds.
*
* @package Joomla.Administrator
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsViewNewsfeeds extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
NewsfeedsHelper::addSubmenu('newsfeeds');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = NewsfeedsHelper::getActions($state->get('filter.category_id'));
$user = JFactory::getUser();
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'), 'newsfeeds.png');
if (count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)
{
JToolbarHelper::addNew('newsfeed.add');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('newsfeed.edit');
}
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::publish('newsfeeds.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('newsfeeds.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::archiveList('newsfeeds.archive');
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::checkin('newsfeeds.checkin');
}
if ($state->get('filter.published') == -2 && $canDo->get('core.delete'))
{
JToolbarHelper::deleteList('', 'newsfeeds.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('newsfeeds.trash');
}
// Add a batch button
if ($user->authorise('core.create', 'com_newsfeeds') && $user->authorise('core.edit', 'com_newsfeeds') && $user->authorise('core.edit.state', 'com_newsfeeds'))
{
JHtml::_('bootstrap.modal', 'collapseModal');
$title = JText::_('JTOOLBAR_BATCH');
$dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\">
<i class=\"icon-checkbox-partial\" title=\"$title\"></i>
$title</button>";
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_newsfeeds');
}
JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS');
JHtmlSidebar::setAction('index.php?option=com_newsfeeds&view=newsfeeds');
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_CATEGORY'),
'filter_category_id',
JHtml::_('select.options', JHtml::_('category.options', 'com_newsfeeds'), 'value', 'text', $this->state->get('filter.category_id'))
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_LANGUAGE'),
'filter_language',
JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))
);
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_TAG'),
'filter_tag',
JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag'))
);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key and display text as value
*
* @since 3.0
*/
protected function getSortFields()
{
return array(
'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('JGLOBAL_TITLE'),
'category_title' => JText::_('JCATEGORY'),
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
'numarticles' => JText::_('COM_NEWSFEEDS_NUM_ARTICLES_HEADING'),
'a.cache_time' => JText::_('COM_NEWSFEEDS_CACHE_TIME_HEADING'),
'a.language' => JText::_('JGRID_HEADING_LANGUAGE'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
}
| gpl-2.0 |
jokeregistry/jokeregistryweb | jokeregistryweb/jokes/tests.py | 3202 | from django.test import TestCase, override_settings, RequestFactory
from jokeregistryweb.jokes.models import Joke
from jokeregistryweb.jokes.views import load
from jokeregistryweb.accounts.models import User
from datetime import datetime
import pytz
import responses
from unittest.mock import MagicMock
class JokeTestCase(TestCase):
@override_settings(TWITTER_BEARER_TOKEN='no-op')
def test_twitter_url_submit(self):
factory = RequestFactory()
request = factory.get('/jokes/load')
response = load(request)
self.assertEquals(response.status_code, 405)
request = factory.post(
'/jokes/load',
{'url': 'https://twitter.com/cregslist/status/651932161755475968'})
user = User.objects.create_user(
username='sean',
email='sean@jokeregistry.online',
password='hunter2')
request.user = user
Joke.objects.import_from_url = MagicMock(return_value=True)
response = load(request)
self.assertTrue(response.status_code < 500)
@responses.activate
@override_settings(TWITTER_BEARER_TOKEN='no-op')
def test_twitter_import(self):
self.assertEquals(User.objects.count(), 0)
sample_response = {
'created_at': 'Thu Oct 08 01:28:34 +0000 2015',
'text': 'Linkedin Park',
'id': 651932161755475968,
'id_str': '651932161755475968',
'user': {
'screen_name': 'cregslist',
'id': 304721573,
}
}
responses.add(
responses.GET,
'https://api.twitter.com/1.1/statuses/show.json',
json=sample_response,
status=200)
joke = Joke.objects.import_from_url('https://twitter.com/cregslist/status/651932161755475968')
self.assertEquals(joke.text, 'Linkedin Park')
self.assertEquals(joke.created, datetime(
year=2015,
month=10,
day=8,
hour=1,
minute=28,
second=34,
tzinfo=pytz.utc
))
self.assertEquals(joke.author.username, '@cregslist')
self.assertEquals(len(responses.calls), 1)
self.assertEquals(User.objects.count(), 1)
@responses.activate
@override_settings(TWITTER_BEARER_TOKEN='no-op')
def test_duplicate_import_guard(self):
self.assertEquals(User.objects.count(), 0)
sample_response = {
'created_at': 'Thu Oct 08 01:28:34 +0000 2015',
'text': 'Linkedin Park',
'id': 651932161755475968,
'id_str': '651932161755475968',
'user': {
'screen_name': 'cregslist',
'id': 304721573,
}
}
responses.add(
responses.GET,
'https://api.twitter.com/1.1/statuses/show.json',
json=sample_response,
status=200)
joke1 = Joke.objects.import_from_url('https://twitter.com/cregslist/status/651932161755475968')
joke2 = Joke.objects.import_from_url('https://twitter.com/cregslist/status/651932161755475968')
self.assertEquals(joke1.id, joke2.id)
| gpl-2.0 |
petterreinholdtsen/cinelerra-hv | plugins/timeavg/timeavgwindow.C | 6976 |
/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "bcdisplayinfo.h"
#include "language.h"
#include "timeavgwindow.h"
#define MAX_FRAMES 1024
TimeAvgWindow::TimeAvgWindow(TimeAvgMain *client)
: PluginClientWindow(client,
250,
400,
250,
400,
0)
{
this->client = client;
}
TimeAvgWindow::~TimeAvgWindow()
{
}
void TimeAvgWindow::create_objects()
{
int x = 10, y = 10;
BC_Bar *bar;
BC_Title *title;
add_tool(title = new BC_Title(x, y, _("Frame count:")));
y += title->get_h() + 5;
add_tool(total_frames = new TimeAvgSlider(client, x, y));
y += 30;
add_tool(paranoid = new TimeAvgParanoid(client, x, y));
y += 30;
add_tool(no_subtract = new TimeAvgNoSubtract(client, x, y));
y += 30;
add_tool(bar = new BC_Bar(x, y, get_w() - x * 2));
y += bar->get_h() + 5;
add_tool(avg = new TimeAvgAvg(client, this, x, y));
y += 30;
add_tool(accum = new TimeAvgAccum(client, this, x, y));
y += 30;
add_tool(bar = new BC_Bar(x, y, get_w() - x * 2));
y += bar->get_h() + 5;
add_tool(replace = new TimeAvgReplace(client, this, x, y));
y += 30;
add_tool(new BC_Title(x, y, _("Threshold:")));
y += title->get_h() + 5;
add_tool(threshold = new TimeThresholdSlider(client, x, y));
y += 30;
add_tool(new BC_Title(x, y, _("Border:")));
y += title->get_h() + 5;
add_tool(border = new TimeBorderSlider(client, x, y));
y += 30;
add_tool(bar = new BC_Bar(x, y, get_w() - x * 2));
y += bar->get_h() + 5;
add_tool(greater = new TimeAvgGreater(client, this, x, y));
y += 30;
add_tool(less = new TimeAvgLess(client, this, x, y));
y += 30;
update_toggles();
show_window();
flush();
}
void TimeAvgWindow::update_toggles()
{
avg->update(client->config.mode == TimeAvgConfig::AVERAGE);
accum->update(client->config.mode == TimeAvgConfig::ACCUMULATE);
replace->update(client->config.mode == TimeAvgConfig::REPLACE);
greater->update(client->config.mode == TimeAvgConfig::GREATER);
less->update(client->config.mode == TimeAvgConfig::LESS);
// if(client->config.mode == TimeAvgConfig::AVERAGE ||
// client->config.mode == TimeAvgConfig::ACCUMULATE)
// {
// no_subtract->enable();
// }
// else
// {
// no_subtract->disable();
// }
if(client->config.mode == TimeAvgConfig::REPLACE)
{
threshold->enable();
border->enable();
}
else
{
threshold->disable();
border->disable();
}
}
TimeAvgSlider::TimeAvgSlider(TimeAvgMain *client, int x, int y)
: BC_ISlider(x,
y,
0,
190,
200,
1,
MAX_FRAMES,
client->config.frames)
{
this->client = client;
}
TimeAvgSlider::~TimeAvgSlider()
{
}
int TimeAvgSlider::handle_event()
{
int result = get_value();
if(result < 1) result = 1;
client->config.frames = result;
client->send_configure_change();
return 1;
}
TimeThresholdSlider::TimeThresholdSlider(TimeAvgMain *client, int x, int y)
: BC_ISlider(x,
y,
0,
190,
200,
1,
255,
client->config.threshold)
{
this->client = client;
}
TimeThresholdSlider::~TimeThresholdSlider()
{
}
int TimeThresholdSlider::handle_event()
{
int result = get_value();
if(result < 1) result = 1;
client->config.threshold = result;
client->send_configure_change();
return 1;
}
TimeBorderSlider::TimeBorderSlider(TimeAvgMain *client, int x, int y)
: BC_ISlider(x,
y,
0,
190,
200,
0,
8,
client->config.border)
{
this->client = client;
}
TimeBorderSlider::~TimeBorderSlider()
{
}
int TimeBorderSlider::handle_event()
{
int result = get_value();
if(result < 0) result = 0;
client->config.border = result;
client->send_configure_change();
return 1;
}
TimeAvgAvg::TimeAvgAvg(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
: BC_Radial(x,
y,
client->config.mode == TimeAvgConfig::AVERAGE,
_("Average"))
{
this->client = client;
this->gui = gui;
}
int TimeAvgAvg::handle_event()
{
int result = get_value();
client->config.mode = TimeAvgConfig::AVERAGE;
gui->update_toggles();
client->send_configure_change();
return 1;
}
TimeAvgAccum::TimeAvgAccum(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
: BC_Radial(x,
y,
client->config.mode == TimeAvgConfig::ACCUMULATE,
_("Accumulate"))
{
this->client = client;
this->gui = gui;
}
int TimeAvgAccum::handle_event()
{
int result = get_value();
client->config.mode = TimeAvgConfig::ACCUMULATE;
gui->update_toggles();
client->send_configure_change();
return 1;
}
TimeAvgReplace::TimeAvgReplace(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
: BC_Radial(x,
y,
client->config.mode == TimeAvgConfig::REPLACE,
_("Replace"))
{
this->client = client;
this->gui = gui;
}
int TimeAvgReplace::handle_event()
{
int result = get_value();
client->config.mode = TimeAvgConfig::REPLACE;
gui->update_toggles();
client->send_configure_change();
return 1;
}
TimeAvgGreater::TimeAvgGreater(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
: BC_Radial(x,
y,
client->config.mode == TimeAvgConfig::GREATER,
_("Greater"))
{
this->client = client;
this->gui = gui;
}
int TimeAvgGreater::handle_event()
{
int result = get_value();
client->config.mode = TimeAvgConfig::GREATER;
gui->update_toggles();
client->send_configure_change();
return 1;
}
TimeAvgLess::TimeAvgLess(TimeAvgMain *client, TimeAvgWindow *gui, int x, int y)
: BC_Radial(x,
y,
client->config.mode == TimeAvgConfig::LESS,
_("Less"))
{
this->client = client;
this->gui = gui;
}
int TimeAvgLess::handle_event()
{
int result = get_value();
client->config.mode = TimeAvgConfig::LESS;
gui->update_toggles();
client->send_configure_change();
return 1;
}
TimeAvgParanoid::TimeAvgParanoid(TimeAvgMain *client, int x, int y)
: BC_CheckBox(x,
y,
client->config.paranoid,
_("Restart for every frame"))
{
this->client = client;
}
int TimeAvgParanoid::handle_event()
{
int result = get_value();
client->config.paranoid = result;
client->send_configure_change();
return 1;
}
TimeAvgNoSubtract::TimeAvgNoSubtract(TimeAvgMain *client, int x, int y)
: BC_CheckBox(x,
y,
client->config.nosubtract,
_("Don't buffer frames"))
{
this->client = client;
}
int TimeAvgNoSubtract::handle_event()
{
int result = get_value();
client->config.nosubtract = result;
client->send_configure_change();
return 1;
}
| gpl-2.0 |
Automattic/amp-wp | blocks/utils.js | 2271 | const { __ } = wp.i18n;
const {
TextControl,
SelectControl,
Notice,
Placeholder
} = wp.components;
/**
* Display media placeholder.
*
* @param {string} name Block's name.
* @param {string|boolean} url URL.
* @return {XML} Placeholder.
*/
export function getMediaPlaceholder( name, url ) {
return (
<Placeholder label={ name }>
<p className="components-placeholder__error">{ url }</p>
<p className="components-placeholder__error">{ __( 'Previews for this are unavailable in the editor, sorry!', 'amp' ) }</p>
</Placeholder>
);
}
/**
* Layout controls for AMP blocks' attributes: layout, width, height.
*
* @param {Object} props Props.
* @param {Array} ampLayoutOptions Layout options.
* @return {[XML,*,XML,*,XML]} Controls.
*/
export function getLayoutControls( props, ampLayoutOptions ) {
// @todo Move getting ampLayoutOptions to utils as well.
const { attributes, setAttributes } = props;
const { ampLayout, height, width } = attributes;
const showHeightNotice = ! height && ( 'fixed' === ampLayout || 'fixed-height' === ampLayout );
const showWidthNotice = ! width && 'fixed' === ampLayout;
return [
<SelectControl
key="ampLayout"
label={ __( 'Layout', 'amp' ) }
value={ ampLayout }
options={ ampLayoutOptions }
onChange={ value => ( setAttributes( { ampLayout: value } ) ) }
/>,
showWidthNotice && (
<Notice key="showWidthNotice" status="error" isDismissible={ false }>
{
wp.i18n.sprintf(
/* translators: %s is the layout name */
__( 'Width is required for %s layout', 'amp' ),
ampLayout
)
}
</Notice>
),
<TextControl
key="width"
type="number"
label={ __( 'Width (px)', 'amp' ) }
value={ width !== undefined ? width : '' }
onChange={ value => ( setAttributes( { width: value } ) ) }
/>,
showHeightNotice && (
<Notice key="showHeightNotice" status="error" isDismissible={ false }>
{
wp.i18n.sprintf(
/* translators: %s is the layout name */
__( 'Height is required for %s layout', 'amp' ),
ampLayout
)
}
</Notice>
),
<TextControl
key="height"
type="number"
label={ __( 'Height (px)', 'amp' ) }
value={ height }
onChange={ value => ( setAttributes( { height: value } ) ) }
/>
];
}
| gpl-2.0 |
idea-lab/Spectrum | wp-content/themes/90s-retro/content/loop-page.php | 1454 | <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!-- BEGIN .page-holder -->
<div class="page-holder">
<!-- BEGIN .article -->
<div class="article">
<?php if ( ! has_post_thumbnail() ) { ?>
<h1 class="headline"><?php the_title(); ?></h1>
<?php } ?>
<?php the_content( esc_html__("Read More", '90s-retro') ); ?>
<?php wp_link_pages(array(
'before' => '<p class="page-links"><span class="link-label">' . esc_html__('Pages:', '90s-retro') . '</span>',
'after' => '</p>',
'link_before' => '<span>',
'link_after' => '</span>',
'next_or_number' => 'next_and_number',
'nextpagelink' => esc_html__('Next', '90s-retro'),
'previouspagelink' => esc_html__('Previous', '90s-retro'),
'pagelink' => '%',
'echo' => 1 )
); ?>
<?php edit_post_link( esc_html__("(Edit)", '90s-retro'), '', '' ); ?>
<!-- END .article -->
</div>
<!-- END .page-holder -->
</div>
<?php if ( comments_open() || '0' != get_comments_number() ) comments_template(); ?>
<div class="clear"></div>
<?php endwhile; else: ?>
<!-- BEGIN .page-holder -->
<div class="page-holder">
<!-- BEGIN .article -->
<div class="article">
<div class="error-404">
<h1 class="headline"><?php esc_html_e("Page Not Found", '90s-retro'); ?></h1>
<p><?php esc_html_e("We're sorry, but the page could not be found.", '90s-retro'); ?></p>
</div>
<!-- END .article -->
</div>
<!-- END .page-holder -->
</div>
<?php endif; ?> | gpl-2.0 |
schmidtfederico/PRinde | core/lib/io/file.py | 3152 | # coding=utf-8
import os
__author__ = 'Federico Schmidt'
def absdirname(f):
"""
Devuelve el path absoluto a la carpeta que contiene al archivo.
@param f
"""
return os.path.abspath(os.path.dirname(os.path.realpath(f)))
def listdir_fullpath(d, onlyFiles=False, recursive=False, filter=None):
ls = os.listdir(d)
if len(ls) == 0:
return []
full_path = [os.path.join(d, f) for f in ls]
if recursive:
for d in full_path:
if os.path.isdir(d):
full_path = full_path + listdir_fullpath(d, onlyFiles=onlyFiles, recursive=True)
if onlyFiles:
full_path = [f for f in full_path if os.path.isfile(f)]
if filter:
full_path = [f for f in full_path if filter(f)]
return full_path
def clean_folder(folder, onlyfiles=False):
"""
Vacía el contenido de una carpeta de ser posible.
@param folder
@param onlyfiles: Especifica si se deben borrar únicamente archivo o también carpetas (default = archivos y carpetas).
@return: True en caso de éxito o False de lo contrario.
"""
for f in os.listdir(folder):
file_path = os.path.join(folder, f)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
elif not onlyfiles:
if len(os.listdir(file_path)) > 0:
clean_folder(file_path)
else:
os.rmdir(file_path)
except Exception, e:
print e
return False
return True
def create_folder(folder):
"""
Crea o vacía la carpeta folder de ser posible.
Devuelve True en caso de éxito o False en caso de haber un error.
@param folder: la carpeta a crear o eliminar.
@return True en caso de éxito o False de lo contrario.
"""
# Verificamos si la carpeta de salida ya existe.
if os.path.exists(folder):
if os.path.isfile(folder):
# Si es un archivo, intentamos borrarlo y crear el directorio.
try:
os.remove(folder)
os.mkdir(folder)
except IOError:
print "No se pudo remover el archivo para crear la carpeta:" + folder + "."
return False
else:
# Si no existe, la intentamos crear.
try:
os.makedirs(folder)
except Exception, ex:
print "No se pudo crear la carpeta: " + folder + ". Exception: %s" % ex
return os.path.exists(folder) and not os.path.isfile(folder)
def filename_without_ext(f):
return os.path.splitext(os.path.basename(f))[0]
def create_folder_with_permissions(parent, folder_name=None, permissions=0777):
if not folder_name:
folder_name = os.path.basename(parent)
parent = os.path.dirname(parent)
if not os.path.isdir(parent):
return False
folder = os.path.join(parent, folder_name)
if not create_folder(folder):
raise RuntimeError('Failed to create folder "%s".' % folder)
else:
# Le cambiamos los permisos a la carpeta.
os.chmod(folder, permissions)
return os.path.abspath(folder) | gpl-2.0 |
chrisb13/mkpaper | examples/example_mkpaper_doc.py | 2303 | # Author: Christopher Bull.
# Affiliation: Climate Change Research Centre and ARC Centre of Excellence for Climate System Science.
# Level 4, Mathews Building
# University of New South Wales
# Sydney, NSW, Australia, 2052
# Contact: z3457920@student.unsw.edu.au
# www: christopherbull.com.au
# Date created: Fri, 13 Nov 2015 14:01:53
# Machine created on: ccrc165
#
"""
Example script of how to use mkpaper (word doc)
Requires python-docx package.
Things to change (see init box):
1] path to mkpaper package (it's the folder CONTAINING mkpaper, e.g. should be /folder_containing_mkpaper/ NOT /folder_containing_mkpaper/mkpaper/ )
2] path to png plots (optional: pending how you cloned)
3] path to doc output (optional: pending how you cloned)
"""
###########################################################################
# INIT -- CHANGE me to make script work.... #
###########################################################################
path_to_mkpaper='/home/nfs/z3457920/hdrive/repos/' #note: it's the folder CONTAINING mkpaper
#IF you cloned to a repo NOT called 'mkpaper' you need to change these lines...
path_to_pngplots=path_to_mkpaper+'mkpaper/examples/figs/'
path_to_doc=path_to_mkpaper+'mkpaper/examples/examplemkpaper/'
###########################################################################
# INIT END #
###########################################################################
import sys,os
sys.path.insert(1,path_to_mkpaper)
import mkpaper as mp
import glob
if __name__ == "__main__":
#get a list of your figures in PNG format...
ifiles=sorted(glob.glob(path_to_pngplots + '*.png' ))
assert(ifiles!=[]),"glob didn't find anything!"
#alternatively, we could be more explicit
#ifile[0]=path_to_doc+'penguin1.png'
#ifile[1]=path_to_doc+'penguin2.png'
#instantiate WordFigureDoc class:
#arguments are: path/to/put/figuredocs and name of figure doc..
figobj=mp.WordFigureDoc(path_to_doc,'penguinfigs')
figobj.add_figure(ifiles[0],'first penguin')
figobj.add_figure(ifiles[1],'second penguin')
#etc
#insert the tail of the doc
figobj.end_doc()
| gpl-2.0 |
amshove/mx_router | webinterface/soap/Turniere.php | 8115 | <?php
#######################################################
# -------------------- mx_router -------------------- #
# Copyright (C) Torsten Amshove <torsten@amshove.net> #
# See: http://www.amshove.net #
#######################################################
$log_ident = substr(md5(mt_rand()),0,5);
openlog("mx_router[soap_turniere_$log_ident]",LOG_ODELAY,LOG_USER); // Logging zu Syslog oeffnen
require("../config.inc.php");
require("../functions.inc.php");
if($_SERVER["REMOTE_ADDR"] != "127.0.0.1" && (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $soap_user || $_SERVER['PHP_AUTH_PW'] != $soap_pw)){
header('WWW-Authenticate: Basic realm="mx_router SOAP"');
header('HTTP/1.0 401 Unauthorized');
echo "Don't Panic!";
exit;
}else{
$soap_url = "http://".$_SERVER['HTTP_HOST']."/soap/Turniere.php";
$wsdl_funktionen = array(
"checkTurnier" => array(
"parameter" => array(
"tid" => "int",
),
"return" => "array",
),
"getStatus" => array(
"parameter" => array(
"tcid" => "int",
),
"return" => "array",
),
"setInternet" => array(
"parameter" => array(
"tcid" => "int",
"tid" => "int",
"ips" => "array",
"reason" => "string",
),
"return" => "array",
),
);
if(isset($_GET["wsdl"])){
echo "<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='SelfService'
targetNamespace='http://".$_SERVER['HTTP_HOST']."/Turniere'
xmlns:tns='http://".$_SERVER['HTTP_HOST']."/Turniere'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>";
foreach($wsdl_funktionen as $fkt => $val){
echo "<message name='".$fkt."Request'>";
foreach($val["parameter"] as $name => $type) echo "<part name='$name' type='xsd:$type'/>";
echo "</message>";
echo "<message name='".$fkt."Response'>
<part name='Result' type='xsd:array'/>
</message>";
echo "<portType name='".$fkt."PortType'>
<operation name='".$fkt."'>
<input message='tns:".$fkt."Request'/>
<output message='tns:".$fkt."Response'/>
</operation>
</portType>";
echo "<binding name='".$fkt."Binding' type='tns:".$fkt."PortType'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='".$fkt."'>
<soap:operation soapAction='urn:Turniere#".$fkt."'/>
<input>
<soap:body use='encoded' namespace='urn:Turniere' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:Turniere' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>";
echo "<service name='".$fkt."Service'>
<port name='".$fkt."Port' binding='".$fkt."Binding'>
<soap:address location='$soap_url'/>
</port>
</service>";
}
echo "</definitions>";
}else{
// Guckt nach, ob das Turnier dem Router bekannt ist
function checkTurnier($tid){
global $db;
return mysqli_num_rows(mysqli_query($db,"SELECT * FROM turniere WHERE turnier_id = '".mysqli_real_escape_string($db,$tid)."' LIMIT 1")) > 0;
// $return - true/false, ob das Turnier im Router angelegt wurde
}
// Gibt den Status fuer das aktuelle Match zurueck
function getStatus($tcid){
global $leitungen_fw, $db;
$tcid = mysqli_real_escape_string($db,$tcid);
$query = mysqli_query($db,"SELECT ip, leitung FROM history WHERE tcid = '".$tcid."' AND active = 1");
if(mysqli_num_rows($query) < 1) return false;
$return = array();
while($row = mysqli_fetch_assoc($query)){
$return[$row["ip"]] = $leitungen_fw[$row["leitung"]]["name"];
}
return $return;
// $return - false - wenn keine Freischaltung vorhanden
// $return["<ip>"] - Name der Leitung auf die die IP freigeschaltet ist
}
// Schaltet das Internet fuer ein Match frei und legt die Teilnehmer auf eine bestimmte Leitung
function setInternet($tcid, $tid, $ips, $reason){
global $db;
$return = array();
$tcid = mysqli_real_escape_string($db,$tcid);
$tid = mysqli_real_escape_string($db,$tid);
$reason = mysqli_real_escape_string($db,$reason);
foreach($ips as $ip){
if(!preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/",$ip)){
$return[0] = false;
$return[1] = "$ip hat das falsche Format.";
return $return;
}
}
$now = time();
my_syslog("Freischalten: tcid $tcid, tid $tid, ips: ".var_export($ips,true).", reason: $reason");
// Leitung raussuchen
$l_anz = 500;
$leitung = -1;
$l = @own_mysqli_result(mysqli_query($db,"SELECT leitungen FROM turniere WHERE turnier_id = '$tid' LIMIT 1"),0,"leitungen");
if(!$l){
$return[0] = false;
$return[1] = "Dem Turnier sind keine Leitungen zugeordnet.";
my_syslog($return[1]);
return $return;
}
$query = mysqli_query($db,"SELECT leitung, COUNT(*) as anz FROM history WHERE leitung IN ($l) AND active = 1 GROUP BY leitung");
$db_anz = array();
my_syslog("Vorhandene Freischaltungen pro Leitung:");
while($row = mysqli_fetch_assoc($query)){
$db_anz[$row["leitung"]] = $row["anz"];
my_syslog($row["leitung"]." => ".$row["anz"]);
}
foreach(explode(",",$l) as $lt){
$anz = 0;
if($db_anz[$lt] > 0) $anz = $db_anz[$lt];
if($anz < $l_anz){
$leitung = $lt;
$l_anz = $anz;
}
}
my_syslog("Leitung rausgesucht: $leitung");
if($leitung < 1){
$return[0] = false;
$return[1] = "Es wurde keine Leitung gefunden.";
my_syslog($return[1]);
return $return;
}
// IPs durchgehen
foreach($ips as $ip){
$old_id = 0;
$query = mysqli_query($db,"SELECT id FROM history WHERE active = 1 AND ip = '$ip' LIMIT 1");
if(mysqli_num_rows($query) > 0){
// Bereits freigeschaltet - loesche alte Regel erstmal
my_syslog("Alte Freischaltung fuer $ip gefunden - wird erst mal geloescht");
$old_id = own_mysqli_result($query,0,"id");
if(!rule_del($old_id,"Turniere")){
$return[0] = false;
$return[1] = "$ip hatte bereits eine Freischaltung - es ist ein Fehler aufgetreten beim Entfernen";
my_syslog($return[1]);
return $return;
}
}
// Neue Regel anlegen
mysqli_query($db,"INSERT INTO history SET ip = '".$ip."', leitung = '$leitung', add_user = 'Turniere', add_date = '".$now."', active = -1, tcid = '$tcid', old_id = '$old_id', reason = '$reason'");
my_syslog("Freiscaltung anlegen fuer $ip");
$id = mysqli_insert_id($db);
if(!($id > 0 && rule_add($id))){
$return[0] = false;
$return[1] = "Es ist ein Fehler aufgetreten beim Freischalten von $ip";
my_syslog($return[1]);
return $return;
}
}
$return[0] = true;
$return[1] = "Freischaltung erfolgreich.";
my_syslog($return[1]);
return $return;
// $return[0] - true/false - Freischaltung erfolgreich/nicht erfolgreich
// $return[1] - (Fehler-)meldung
}
## Funktionen registrieren
$server = new SoapServer("http://127.0.0.1/soap/Turniere.php?wsdl",array('encoding'=>'ISO-8859-1'));
foreach($wsdl_funktionen as $fkt => $val) $server->addFunction($fkt);
$server->handle();
}
}
?>
| gpl-2.0 |
vcmi/vcmi_old_mirror | lib/mapping/CMap.cpp | 12586 | #include "StdInc.h"
#include "CMap.h"
#include "../CArtHandler.h"
#include "../VCMI_Lib.h"
#include "../CCreatureHandler.h"
#include "../CTownHandler.h"
#include "../CHeroHandler.h"
#include "../CDefObjInfoHandler.h"
#include "../CGeneralTextHandler.h"
#include "../CSpellHandler.h"
#include "CMapEditManager.h"
SHeroName::SHeroName() : heroId(-1)
{
}
PlayerInfo::PlayerInfo(): canHumanPlay(false), canComputerPlay(false),
aiTactic(EAiTactic::RANDOM), isFactionRandom(false), mainCustomHeroPortrait(-1), mainCustomHeroId(-1), hasMainTown(false),
generateHeroAtMainTown(false), team(255), hasRandomHero(false), /* following are unused */ generateHero(false), p7(0), powerPlaceholders(-1)
{
auto allowed = VLC->townh->getDefaultAllowed();
for (size_t i=0; i<allowed.size(); i++)
if (allowed[i])
allowedFactions.insert(i);
}
si8 PlayerInfo::defaultCastle() const
{
if(allowedFactions.size() == 1 || !isFactionRandom)
{
// faction can't be chosen - set to first that is marked as allowed
assert(!allowedFactions.empty());
return *allowedFactions.begin();
}
// set to random
return -1;
}
si8 PlayerInfo::defaultHero() const
{
// we will generate hero in front of main town
if((generateHeroAtMainTown && hasMainTown) || hasRandomHero)
{
//random hero
return -1;
}
return -2;
}
bool PlayerInfo::canAnyonePlay() const
{
return canHumanPlay || canComputerPlay;
}
bool PlayerInfo::hasCustomMainHero() const
{
return !mainCustomHeroName.empty() && mainCustomHeroPortrait != -1;
}
EventCondition::EventCondition(EWinLoseType condition):
object(nullptr),
value(-1),
objectType(-1),
position(-1, -1, -1),
condition(condition)
{
}
EventCondition::EventCondition(EWinLoseType condition, si32 value, si32 objectType, int3 position):
object(nullptr),
value(value),
objectType(objectType),
position(position),
condition(condition)
{}
DisposedHero::DisposedHero() : heroId(0), portrait(255), players(0)
{
}
CMapEvent::CMapEvent() : players(0), humanAffected(0), computerAffected(0),
firstOccurence(0), nextOccurence(0)
{
}
bool CMapEvent::earlierThan(const CMapEvent & other) const
{
return firstOccurence < other.firstOccurence;
}
bool CMapEvent::earlierThanOrEqual(const CMapEvent & other) const
{
return firstOccurence <= other.firstOccurence;
}
CCastleEvent::CCastleEvent() : town(nullptr)
{
}
TerrainTile::TerrainTile() : terType(ETerrainType::BORDER), terView(0), riverType(ERiverType::NO_RIVER),
riverDir(0), roadType(ERoadType::NO_ROAD), roadDir(0), extTileFlags(0), visitable(false),
blocked(false)
{
}
bool TerrainTile::entrableTerrain(const TerrainTile * from /*= nullptr*/) const
{
return entrableTerrain(from ? from->terType != ETerrainType::WATER : true, from ? from->terType == ETerrainType::WATER : true);
}
bool TerrainTile::entrableTerrain(bool allowLand, bool allowSea) const
{
return terType != ETerrainType::ROCK
&& ((allowSea && terType == ETerrainType::WATER) || (allowLand && terType != ETerrainType::WATER));
}
bool TerrainTile::isClear(const TerrainTile *from /*= nullptr*/) const
{
return entrableTerrain(from) && !blocked;
}
int TerrainTile::topVisitableId() const
{
return visitableObjects.size() ? visitableObjects.back()->ID : -1;
}
CGObjectInstance * TerrainTile::topVisitableObj() const
{
return visitableObjects.size() ? visitableObjects.back() : nullptr;
}
bool TerrainTile::isCoastal() const
{
return extTileFlags & 64;
}
bool TerrainTile::hasFavourableWinds() const
{
return extTileFlags & 128;
}
bool TerrainTile::isWater() const
{
return terType == ETerrainType::WATER;
}
const int CMapHeader::MAP_SIZE_SMALL = 36;
const int CMapHeader::MAP_SIZE_MIDDLE = 72;
const int CMapHeader::MAP_SIZE_LARGE = 108;
const int CMapHeader::MAP_SIZE_XLARGE = 144;
void CMapHeader::setupEvents()
{
EventCondition victoryCondition(EventCondition::STANDARD_WIN);
EventCondition defeatCondition(EventCondition::DAYS_WITHOUT_TOWN);
defeatCondition.value = 7;
//Victory condition - defeat all
TriggeredEvent standardVictory;
standardVictory.effect.type = EventEffect::VICTORY;
standardVictory.effect.toOtherMessage = VLC->generaltexth->allTexts[5];
standardVictory.identifier = "standardVictory";
standardVictory.description = ""; // TODO: display in quest window
standardVictory.onFulfill = VLC->generaltexth->allTexts[659];
standardVictory.trigger = EventExpression(victoryCondition);
//Loss condition - 7 days without town
TriggeredEvent standardDefeat;
standardDefeat.effect.type = EventEffect::DEFEAT;
standardDefeat.effect.toOtherMessage = VLC->generaltexth->allTexts[8];
standardDefeat.identifier = "standardDefeat";
standardDefeat.description = ""; // TODO: display in quest window
standardDefeat.onFulfill = VLC->generaltexth->allTexts[7];
standardDefeat.trigger = EventExpression(defeatCondition);
triggeredEvents.push_back(standardVictory);
triggeredEvents.push_back(standardDefeat);
victoryIconIndex = 11;
victoryMessage = VLC->generaltexth->victoryConditions[0];
defeatIconIndex = 3;
defeatMessage = VLC->generaltexth->lossCondtions[0];
}
CMapHeader::CMapHeader() : version(EMapFormat::SOD), height(72), width(72),
twoLevel(true), difficulty(1), levelLimit(0), howManyTeams(0), areAnyPlayers(false)
{
setupEvents();
allowedHeroes = VLC->heroh->getDefaultAllowed();
players.resize(PlayerColor::PLAYER_LIMIT_I);
}
CMapHeader::~CMapHeader()
{
}
CMap::CMap() : checksum(0), grailPos(-1, -1, -1), grailRadious(0), terrain(nullptr)
{
allHeroes.resize(allowedHeroes.size());
allowedAbilities = VLC->heroh->getDefaultAllowedAbilities();
allowedArtifact = VLC->arth->getDefaultAllowed();
allowedSpell = VLC->spellh->getDefaultAllowed();
}
CMap::~CMap()
{
if(terrain)
{
for(int ii=0;ii<width;ii++)
{
for(int jj=0;jj<height;jj++)
delete [] terrain[ii][jj];
delete [] terrain[ii];
}
delete [] terrain;
}
}
void CMap::removeBlockVisTiles(CGObjectInstance * obj, bool total)
{
for(int fx=0; fx<obj->getWidth(); ++fx)
{
for(int fy=0; fy<obj->getHeight(); ++fy)
{
int xVal = obj->pos.x - fx;
int yVal = obj->pos.y - fy;
int zVal = obj->pos.z;
if(xVal>=0 && xVal<width && yVal>=0 && yVal<height)
{
TerrainTile & curt = terrain[xVal][yVal][zVal];
if(total || obj->visitableAt(xVal, yVal))
{
curt.visitableObjects -= obj;
curt.visitable = curt.visitableObjects.size();
}
if(total || obj->blockingAt(xVal, yVal))
{
curt.blockingObjects -= obj;
curt.blocked = curt.blockingObjects.size();
}
}
}
}
}
void CMap::addBlockVisTiles(CGObjectInstance * obj)
{
for(int fx=0; fx<obj->getWidth(); ++fx)
{
for(int fy=0; fy<obj->getHeight(); ++fy)
{
int xVal = obj->pos.x - fx;
int yVal = obj->pos.y - fy;
int zVal = obj->pos.z;
if(xVal>=0 && xVal<width && yVal>=0 && yVal<height)
{
TerrainTile & curt = terrain[xVal][yVal][zVal];
if( obj->visitableAt(xVal, yVal))
{
curt.visitableObjects.push_back(obj);
curt.visitable = true;
}
if( obj->blockingAt(xVal, yVal))
{
curt.blockingObjects.push_back(obj);
curt.blocked = true;
}
}
}
}
}
CGHeroInstance * CMap::getHero(int heroID)
{
for(auto & elem : heroesOnMap)
if(elem->subID == heroID)
return elem;
return nullptr;
}
bool CMap::isInTheMap(const int3 & pos) const
{
if(pos.x < 0 || pos.y < 0 || pos.z < 0 || pos.x >= width || pos.y >= height
|| pos.z > (twoLevel ? 1 : 0))
{
return false;
}
else
{
return true;
}
}
TerrainTile & CMap::getTile(const int3 & tile)
{
assert(isInTheMap(tile));
return terrain[tile.x][tile.y][tile.z];
}
const TerrainTile & CMap::getTile(const int3 & tile) const
{
assert(isInTheMap(tile));
return terrain[tile.x][tile.y][tile.z];
}
bool CMap::isWaterTile(const int3 &pos) const
{
return isInTheMap(pos) && getTile(pos).terType == ETerrainType::WATER;
}
const CGObjectInstance * CMap::getObjectiveObjectFrom(int3 pos, Obj::EObj type)
{
for (CGObjectInstance * object : getTile(pos).visitableObjects)
{
if (object->ID == type)
return object;
}
// There is weird bug because of which sometimes heroes will not be found properly despite having correct position
// Try to workaround that and find closest object that we can use
logGlobal->errorStream() << "Failed to find object of type " << int(type) << " at " << pos;
logGlobal->errorStream() << "Will try to find closest matching object";
CGObjectInstance * bestMatch = nullptr;
for (CGObjectInstance * object : objects)
{
if (object && object->ID == type)
{
if (bestMatch == nullptr)
bestMatch = object;
else
{
if (object->pos.dist2d(pos) < bestMatch->pos.dist2d(pos))
bestMatch = object;// closer than one we already found
}
}
}
assert(bestMatch != nullptr); // if this happens - victory conditions or map itself is very, very broken
logGlobal->errorStream() << "Will use " << bestMatch->getHoverText() << " from " << bestMatch->pos;
return bestMatch;
}
void CMap::checkForObjectives()
{
// NOTE: probably should be moved to MapFormatH3M.cpp
for (TriggeredEvent & event : triggeredEvents)
{
auto patcher = [&](EventCondition & cond)
{
switch (cond.condition)
{
break; case EventCondition::HAVE_ARTIFACT:
boost::algorithm::replace_first(event.onFulfill, "%s", VLC->arth->artifacts[cond.objectType]->Name());
break; case EventCondition::HAVE_CREATURES:
boost::algorithm::replace_first(event.onFulfill, "%s", VLC->creh->creatures[cond.objectType]->nameSing);
boost::algorithm::replace_first(event.onFulfill, "%d", boost::lexical_cast<std::string>(cond.value));
break; case EventCondition::HAVE_RESOURCES:
boost::algorithm::replace_first(event.onFulfill, "%s", VLC->generaltexth->restypes[cond.objectType]);
boost::algorithm::replace_first(event.onFulfill, "%d", boost::lexical_cast<std::string>(cond.value));
break; case EventCondition::HAVE_BUILDING:
if (isInTheMap(cond.position))
cond.object = getObjectiveObjectFrom(cond.position, Obj::TOWN);
break; case EventCondition::CONTROL:
if (isInTheMap(cond.position))
cond.object = getObjectiveObjectFrom(cond.position, Obj::EObj(cond.objectType));
if (cond.object)
{
const CGTownInstance *town = dynamic_cast<const CGTownInstance*>(cond.object);
if (town)
boost::algorithm::replace_first(event.onFulfill, "%s", town->name);
const CGHeroInstance *hero = dynamic_cast<const CGHeroInstance*>(cond.object);
if (hero)
boost::algorithm::replace_first(event.onFulfill, "%s", hero->name);
}
break; case EventCondition::DESTROY:
if (isInTheMap(cond.position))
cond.object = getObjectiveObjectFrom(cond.position, Obj::EObj(cond.objectType));
if (cond.object)
{
const CGHeroInstance *hero = dynamic_cast<const CGHeroInstance*>(cond.object);
if (hero)
boost::algorithm::replace_first(event.onFulfill, "%s", hero->name);
}
break; case EventCondition::TRANSPORT:
cond.object = getObjectiveObjectFrom(cond.position, Obj::TOWN);
//break; case EventCondition::DAYS_PASSED:
//break; case EventCondition::IS_HUMAN:
//break; case EventCondition::DAYS_WITHOUT_TOWN:
//break; case EventCondition::STANDARD_WIN:
}
};
event.trigger.forEach(patcher);
}
}
void CMap::addNewArtifactInstance(CArtifactInstance * art)
{
art->id = ArtifactInstanceID(artInstances.size());
artInstances.push_back(art);
}
void CMap::eraseArtifactInstance(CArtifactInstance * art)
{
assert(artInstances[art->id.getNum()] == art);
artInstances[art->id.getNum()].dellNull();
}
void CMap::addQuest(CGObjectInstance * quest)
{
auto q = dynamic_cast<IQuestObject *>(quest);
q->quest->qid = quests.size();
quests.push_back(q->quest);
}
void CMap::initTerrain()
{
terrain = new TerrainTile**[width];
for(int i = 0; i < width; ++i)
{
terrain[i] = new TerrainTile*[height];
for(int j = 0; j < height; ++j)
{
terrain[i][j] = new TerrainTile[twoLevel ? 2 : 1];
}
}
}
CMapEditManager * CMap::getEditManager()
{
if(!editManager) editManager = make_unique<CMapEditManager>(this);
return editManager.get();
}
| gpl-2.0 |
ccp137/GemPuzzle | cchai/gempuzzle/gempuzzle/main.cpp | 280 | //
// main.cpp -- entry point for testing GemPuzzle project
//
// Written by Xiaotian Zhu
//
#include <iostream>
#include "Puzzle.h"
#include "Game.h"
#include "tests.h"
#include <time.h>
using namespace std;
int main()
{
testPuzzle();
//testGame();
return 0;
}
| gpl-2.0 |
slip/Sorba-Atlanta-Redesign | node_modules/devbridge-styleguide/app.js | 1511 | var express = require('express'),
bodyParser = require('body-parser'),
snippets = require('./routes/snippets'),
categories = require('./routes/categories'),
scraper = require('./routes/scrape'),
app = express();
//var logger = require('morgan');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
//app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: false
}));
app.use(function(req, res, next) {
if (req.headers.origin) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'X-Requested-With,Content-Type,Authorization');
res.header('Access-Control-Allow-Methods', 'GET,PUT,PATCH,POST,DELETE');
if (req.method === 'OPTIONS') return res.sendStatus(200);
}
next();
});
app.use('/snippets', snippets);
app.use('/categories', categories);
app.use('/scrape', scraper);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res) {
res.status(err.status || 500);
res.json({
message: err.message,
error: err
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res) {
res.status(err.status || 500);
res.json({
message: err.message,
error: {}
});
});
module.exports = app; | gpl-2.0 |
soeffing/openx_test | lib/max/other/common.php | 27987 | <?php
/*
+---------------------------------------------------------------------------+
| OpenX v2.8 |
| ========== |
| |
| Copyright (c) 2003-2009 OpenX Limited |
| For contact details, see: http://www.openx.org/ |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or |
| (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+---------------------------------------------------------------------------+
$Id: common.php 81439 2012-05-07 23:59:14Z chris.nutting $
*/
require_once MAX_PATH . '/lib/max/Admin_DA.php';
require_once MAX_PATH . '/lib/max/other/lib-acl.inc.php';
// +---------------------------------------+
// | generic permission checks |
// | |
// | filtering by user type |
// +---------------------------------------+
function MAX_checkGenericId($id)
{
return !empty($id) && preg_match('/^\d+$/D', $id);
}
function MAX_checkAd($advertiserId, $placementId, $adId)
{
$allowed = false;
if (MAX_checkGenericId($advertiserId) && MAX_checkGenericId($placementId) && MAX_checkGenericId($adId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
// determine if there are 1 or more ads
$allowed = (count(
Admin_DA::getAds(
array(
'advertiser_id' => $advertiserId,
'placement_id' => $placementId,
'ad_id' => $adId))));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
// determine if there are 1 or more ads
$allowed = (count(
Admin_DA::getAds(
array(
'agency_id' => OA_Permission::getAgencyId(),
'advertiser_id' => $advertiserId,
'placement_id' => $placementId,
'ad_id' => $adId))));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$allowed = ($advertiserId == OA_Permission::getEntityId())
&& count(Admin_DA::getAds(
array( 'advertiser_id' => $advertiserId,
'placement_id' => $placementId,
'ad_id' => $adId)));
}
}
return $allowed;
}
function MAX_checkAdvertiser($advertiserId, $aParams = array())
{
$allowed = false;
if (MAX_checkGenericId($advertiserId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$allowed = count(Admin_DA::getAdvertisers($aParams + array('advertiser_id' => $advertiserId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$allowed = count(Admin_DA::getAdvertisers(
$aParams +
array( 'agency_id' => OA_Permission::getAgencyId(),
'advertiser_id' => $advertiserId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$allowed = ($advertiserId == OA_Permission::getEntityId())
&& count(Admin_DA::getAdvertisers($aParams + array('advertiser_id' => $advertiserId)));
}
}
return $allowed;
}
function MAX_checkAgency($agencyId)
{
$allowed = false;
if (MAX_checkGenericId($agencyId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$allowed = count(Admin_DA::getAgencies(array('agency_id' => $agencyId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$allowed = ($agencyId == OA_Permission::getEntityId())
&& count(Admin_DA::getAgencies(array('agency_id' => $agencyId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$allowed = ($agencyId == OA_Permission::getAgencyId())
&& count(Admin_DA::getAgencies(array('agency_id' => $agencyId)));
}
}
return $allowed;
}
function MAX_checkPublisher($publisherId)
{
$allowed = false;
if (MAX_checkGenericId($publisherId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$allowed = count(Admin_DA::getPublishers(array('publisher_id' => $publisherId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$allowed = count(Admin_DA::getPublishers(
array( 'agency_id' => OA_Permission::getAgencyId(),
'publisher_id' => $publisherId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
$allowed = ($publisherId == OA_Permission::getEntityId())
&& count(Admin_DA::getPublishers(array('publisher_id' => $publisherId)));
}
}
return $allowed;
}
function MAX_checkPlacement($advertiserId, $placementId, $aParams = array())
{
$allowed = false;
if (MAX_checkGenericId($advertiserId) && MAX_checkGenericId($placementId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$allowed = count(Admin_DA::getPlacements(
$aParams +
array( 'advertiser_id' => $advertiserId,
'placement_id' => $placementId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$allowed = count(Admin_DA::getPlacements(
$aParams +
array( 'agency_id' => OA_Permission::getAgencyId(),
'advertiser_id' => $advertiserId,
'placement_id' => $placementId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$allowed = ($advertiserId == OA_Permission::getEntityId())
&& count(Admin_DA::getPlacements(
$aParams +
array( 'advertiser_id' => $advertiserId,
'placement_id' => $placementId)));
}
}
return $allowed;
}
function MAX_checkTracker($advertiserId, $trackerId)
{
$allowed = false;
if (MAX_checkGenericId($advertiserId) && MAX_checkGenericId($trackerId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$allowed = count(Admin_DA::getTrackers(
array( 'advertiser_id' => $advertiserId,
'tracker_id' => $trackerId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$allowed = count(Admin_DA::getTrackers(
array( 'agency_id' => OA_Permission::getAgencyId(),
'advertiser_id' => $advertiserId,
'tracker_id' => $trackerId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$allowed = ($advertiserId == OA_Permission::getEntityId())
&& count(Admin_DA::getTrackers(
array( 'advertiser_id' => $advertiserId,
'tracker_id' => $trackerId)));
}
}
return $allowed;
}
function MAX_checkZone($publisherId, $zoneId)
{
$allowed = false;
if (MAX_checkGenericId($publisherId) && MAX_checkGenericId($zoneId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$allowed = count(Admin_DA::getZones(
array( 'publisher_id' => $publisherId,
'zone_id' => $zoneId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$allowed = count(Admin_DA::getZones(
array( 'agency_id' => OA_Permission::getAgencyId(),
'publisher_id' => $publisherId,
'zone_id' => $zoneId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
$allowed = ($publisherId == OA_Permission::getEntityId())
&& count(Admin_DA::getZones(
array( 'publisher_id' => $publisherId,
'zone_id' => $zoneId)));
}
}
return $allowed;
}
function MAX_checkAdZoneValid($aZone, $aAd)
{
$valid = true;
if ($aZone['width'] != -1 && $aZone['width'] != $aAd['width']) {
$valid = false;
} elseif ($aZone['height'] != -1 && $aZone['height'] != $aAd['height']) {
$valid = false;
} elseif ($aAd['type'] == 'txt' && $aZone['type'] != phpAds_ZoneText) {
$valid = false;
} elseif ($aZone['type'] == phpAds_ZoneText && $aAd['type'] != 'txt') {
$valid = false;
}
return $valid;
}
function MAX_checkChannel($agencyId, $channelId)
{
$allowed = false;
if (MAX_checkGenericId($agencyId) && MAX_checkGenericId($channelId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$allowed = count(Admin_DA::getChannels(
array( 'channel_id' => $channelId,
'channel_type' => 'admin')));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$allowed = count(Admin_DA::getChannels(
array( 'agency_id' => $agencyId,
'channel_id' => $channelId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
$allowed = false;
}
}
return $allowed;
}
function MAX_getPlacementName($aPlacement, $length = null)
{
if (!empty($aPlacement)) {
if ((OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) || OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) && MAX_isAnonymous($aPlacement['anonymous'])) {
$name = $GLOBALS['strHiddenCampaign'] . ' ' . $aPlacement['placement_id'];
} else {
$name = empty($aPlacement['name']) ? $GLOBALS['strUntitled'] : $aPlacement['name'];
}
} else {
$name = '';
}
if (is_numeric($length) && sizeof($name) > $length) {
$name = substr($name, 0, $length);
}
return $name;
}
function MAX_getAdName($description, $alt = null, $length = null, $anonymous = false, $id = null)
{
$name = $GLOBALS['strUntitled'];
if (!empty($alt)) $name = $alt;
if (!empty($description)) $name = $description;
if ((OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) || OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) && MAX_isAnonymous($anonymous)) {
$name = $GLOBALS['strHiddenAd'];
if (!empty($id)) {
$name = $name . ' ' . $id;
}
}
if (is_numeric($length) && sizeof($name) > $length) {
$name = substr($name, 0, $length);
}
return $name;
}
function MAX_getZoneName($zoneName, $length = null, $anonymous = false, $id = null)
{
$name = $GLOBALS['strUntitled'];
if (!empty($zoneName)) $name = $zoneName;
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) && MAX_isAnonymous($anonymous)) {
$name = $GLOBALS['strHiddenZone'];
if (!empty($id)) {
$name = $name . ' ' . $id;
}
}
if (is_numeric($length) && sizeof($name) > $length) {
$name = substr($name, 0, $length);
}
return $name;
}
function MAX_getPublisherName($publisherName, $length = null, $anonymous = false, $id = null)
{
$name = $GLOBALS['strUntitled'];
if (!empty($publisherName)) $name = $publisherName;
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) && MAX_isAnonymous($anonymous)) {
$name = $GLOBALS['strHiddenWebsite'];
if (!empty($id)) {
$name = $name . ' ' . $id;
}
}
if (is_numeric($length) && sizeof($name) > $length) {
$name = substr($name, 0, $length);
}
return $name;
}
function MAX_getTrackerName($trackerName, $length = null, $anonymous = false, $id = null)
{
$name = $GLOBALS['strUntitled'];
if (!empty($trackerName)) $name = $trackerName;
if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) && MAX_isAnonymous($anonymous)) {
$name = $GLOBALS['strHiddenTracker'];
if (!empty($id)) {
$name = $name . ' ' . $id;
}
}
if (is_numeric($length) && sizeof($name) > $length) {
$name = substr($name, 0, $length);
}
return $name;
}
function MAX_getAdvertiserName($advertiserName, $length = null, $anonymous = false, $id = null)
{
$name = $GLOBALS['strUntitled'];
if (!empty($advertiserName)) $name = $advertiserName;
if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) && MAX_isAnonymous($anonymous)) {
$name = $GLOBALS['strHiddenAdvertiser'];
if (!empty($id)) {
$name = $name . ' ' . $id;
}
}
if (is_numeric($length) && sizeof($name) > $length) {
$name = substr($name, 0, $length);
}
return $name;
}
function MAX_getBannerName($description, $alt)
{
global $strUntitled;
$name = $strUntitled;
if (!empty($alt)) $name = $alt;
if (!empty($description)) $name = $description;
$name = phpAds_breakString ($name, '30');
return $name;
}
/**
* many methods are expecting $anonymous to be a boolean value
* although it is held as enum ('t','f') in table
* use this method to ensure the correct type gets passed
*
* @param string | boolean $anonymous
* @return boolean
*/
function MAX_isAnonymous($anonymous)
{
return ($anonymous === 'f' ? false : ($anonymous === 't' ? true : $anonymous) );
}
/**
* Retained for backward-compatibility.
*
* @param string $key
* @param object $default
* @deprecated Use MAX_commonGetValue() instead.
* @see MAX_commonGetValue()
*/
function MAX_getValue($key, $default = null)
{
return MAX_commonGetValue($key, $default);
}
/**
* This function returns value from the $_REQUEST array stored under
* $key key. If magic_quotes_gpc is not enabled it adds the slashes to the
* value before returning it. If the value is not defined in the $_REQUEST
* then the value passed as $default is returned.
*
* @param string $key
* @param object $default
*/
function MAX_commonGetValue($key, $default = null)
{
$value = $default;
if (isset($_REQUEST[$key])) {
$value = $_REQUEST[$key];
if (!get_magic_quotes_gpc()) {
return MAX_commonSlashArray($value);
}
}
return $value;
}
/**
* This function returns value from the $_REQUEST array stored under
* $key key. If magic_quotes_gpc is enabled it removes the slashes to the
* value before returning it. If the value is not defined in the $_REQUEST
* then the value passed as $default is returned.
*
* @param string $key
* @param object $default
*/
function MAX_commonGetValueUnslashed($key, $default = null)
{
return _commonGetValueUnslashed($_REQUEST, $key, $default);
}
/**
* Returns value stored under the $key in the $aValues array. If
* magic_quotes_gpc is enabled it removes the slashes to the
* value before returning it. If the value is not defined in the $aValues
* then the value passed as $default is returned.
*
* @param array $aValues
* @param string $sKey
* @param object $oDefault
* @return object
*/
function _commonGetValueUnslashed($aValues, $sKey, $oDefault = null)
{
$value = $oDefault;
if (isset($aValues[$sKey])) {
$value = $aValues[$sKey];
if (get_magic_quotes_gpc()) {
return MAX_commonUnslashArray($value);
}
}
return $value;
}
/**
* Returns the value stored under the $key in the $_POST. If
* magic_quotes_gpc is enabled it removes the slashes from the
* value before returning it. If the value is not defined in the $_POST
* then the $_GET array is checked. If the value is still not found then
* $sDefault is returned. Whichever value is returned, it is trimmed first.
*
* @param string $sKey
* @param string $sDefault
* @return string
*/
function MAX_commonGetPostValueUnslashed($sKey, $sDefault = null)
{
$value = _commonGetValueUnslashed($_POST, $sKey);
if (is_null($value)) {
$value = _commonGetValueUnslashed($_GET, $sKey);
}
if (is_null($value)) {
$value = $sDefault;
}
if (is_null($value)) {
return null;
}
return trim($value);
}
function MAX_getStoredValue($key, $default, $pageName=null, $allowEmpty = false)
{
global $session, $pgName;
if (!isset($pageName)) {
if(isset($pgName)) {
$pageName = $pgName;
} else {
$pageName = basename($_SERVER['SCRIPT_NAME']);
}
}
$value = $default;
if (isset($_REQUEST[$key]) && (!empty($_REQUEST[$key]) || $allowEmpty)) {
$value = $_REQUEST[$key];
if (!get_magic_quotes_gpc()) MAX_addslashes($value);
} elseif (isset($session['prefs']['GLOBALS'][$key])) {
$value = $session['prefs']['GLOBALS'][$key];
} elseif (isset($session['prefs'][$pageName][$key])) {
$value = $session['prefs'][$pageName][$key];
}
return $value;
}
function MAX_changeStoredValue($key, $value)
{
global $session;
$pageName = basename($_SERVER['SCRIPT_NAME']);
if (isset($_REQUEST[$key])) {
$_REQUEST[$key] = $value;
}
if (isset($_GET[$key])) {
$_GET[$key] = $value;
}
if (isset($_POST[$key])) {
$_POST[$key] = $value;
}
if (isset($session['prefs']['GLOBALS'][$key])) {
$session['prefs']['GLOBALS'][$key] = $value;
}
if (isset($session['prefs'][$pageName][$key])) {
$session['prefs'][$pageName][$key] = $value;
}
return true;
}
function MAX_addslashes(&$item)
{
$item = MAX_commonSlashArray($item);
}
/**
* Recursively add slashes to the values in an array.
*
* @param array Input array.
* @return array Output array with values slashed.
*/
function MAX_commonSlashArray($a)
{
if (is_array($a)) {
reset($a);
while (list($k,$v) = each($a)) {
$a[$k] = MAX_commonSlashArray($v);
}
reset ($a);
return ($a);
} else {
return is_null($a) ? null : addslashes($a);
}
}
/**
* Recursively removes slashes from the values in an array.
*
* @param array Input array.
* @return array Output array with values unslashed.
*/
function MAX_commonUnslashArray($a)
{
if (is_array($a)) {
reset($a);
while (list($k,$v) = each($a)) {
$a[$k] = MAX_commonUnslashArray($v);
}
reset ($a);
return ($a);
} else {
return stripslashes($a);
}
}
// +---------------------------------------+
// | array utilties |
// +---------------------------------------+
// this is never called
function MAX_arrayMergeRecursive(&$a, &$b)
{
$keys = array_keys($a);
foreach ($keys as $key) {
if (isset($b[$key])) {
if (is_array($a[$key]) && is_array($b[$key])) {
//????????? the 'merge' fn not only is not a PHP fn, it's not defined anywhere, go figure ...
merge($a[$key], $b[$key]);
} else {
$a[$key] = $b[$key];
}
}
}
$keys = array_keys($b);
foreach ($keys as $key) {
if (!isset($a[$key])) {
$a[$key] = $b[$key];
}
}
}
function MAX_getStoredArray($key, $default)
{
global $session;
$pageName = basename($_SERVER['SCRIPT_NAME']);
$value = $default;
if (isset($_REQUEST[$key])) {
$value = explode(',',$_REQUEST[$key]);
if (!get_magic_quotes_gpc()) {
MAX_addslashes($value);
}
} elseif (isset($session['prefs'][$pageName][$key])) {
$value = explode(',',$session['prefs'][$pageName][$key]);
}
return $value;
}
// +---------------------------------------+
// | tree node state handling |
// +---------------------------------------+
function MAX_adjustNodes(&$aNodes, $expand, $collapse)
{
if (!empty($expand)) {
if ($expand != 'all') {
if ($expand == 'none') {
$aNodes = array();
}
elseif (!in_array($expand, $aNodes)) {
$aNodes[] = $expand;
}
}
}
if (!empty($collapse) && in_array($collapse, $aNodes) ) {
unset($aNodes[array_search($collapse, $aNodes)]);
}
}
/**
* Determine if a node is expanded or not.
*
* @param integer $id
* @param string $expand
* @param array $aNodes
* @param string $prefix
* @return boolean
*/
function MAX_isExpanded($id, $expand, &$aNodes, $prefix)
{
$isExpanded = false;
if ($expand == 'all') {
$isExpanded = true;
if (!in_array($prefix . $id, $aNodes)) {
$aNodes[] = $prefix . $id;
}
} elseif ($expand != 'none' && in_array($prefix . $id, $aNodes)) {
$isExpanded = true;
}
return $isExpanded;
}
// +---------------------------------------+
// | adjustments |
// +---------------------------------------+
function MAX_addDefaultPlacementZones($adId, $placementId)
{
$aAdZones = Admin_DA::getAdZones(array('ad_id' => $adId), true, 'zone_id');
$aPlacementZones = Admin_DA::getPlacementZones(array('placement_id' => $placementId), true, 'zone_id');
if (!empty($aPlacementZones)) {
foreach ($aPlacementZones as $zoneId => $aPlacementZone) {
if (!isset($aAdZones[$zoneId])) {
Admin_DA::addAdZone(array('ad_id' => $adId, 'zone_id' => $zoneId));
}
}
}
}
// For a given ad id, make sure that zones have correct size/type. Otherwise, unlink ads from the zone...
function MAX_adjustAdZones($adId)
{
$aAdZones = Admin_DA::getAdZones(array('ad_id' => $adId), true, 'zone_id');
if (!empty($aAdZones)) {
$aAd = Admin_DA::getAd($adId);
$aZones = Admin_DA::getZones(array('zone_id' => implode(',', array_keys($aAdZones))), true);
// get zones linked to this campaign
$aPlacementZones = Admin_DA::getPlacementZones(array('placement_id' => $aAd['placement_id']), true, 'zone_id');
foreach ($aZones as $zoneId => $aZone) {
if (!MAX_checkAdZoneValid($aZone, $aAd)) {
Admin_DA::deleteAdZones(array('zone_id' => $zoneId, 'ad_id' => $adId));
} else {
// if ad's campaign is linked to this zone, link ad to zone
if (isset($aPlacementZones[$zoneId])) {
Admin_DA::addAdZone(array('zone_id' => $zoneId, 'ad_id' => $adId));
}
}
}
}
}
function MAX_adjustZoneAds($zoneId)
{
$aAdZones = Admin_DA::getAdZones(array('zone_id' => $zoneId), true, 'ad_id');
if (!empty($aAdZones)) {
$aZone = Admin_DA::getZone($zoneId);
$aAds = Admin_DA::getAds(array('ad_id' => implode(',', array_keys($aAdZones))));
foreach ($aAds as $adId => $aAd) {
if (!MAX_checkAdZoneValid($aZone, $aAd)) {
Admin_DA::deleteAdZones(array('zone_id' => $zoneId, 'ad_id' => $adId));
}
}
}
}
function MAX_addLinkedAdsToZone($zoneId, $placementId)
{
$aParams = MAX_getLinkedAdParams($zoneId);
$aParams['placement_id'] = $placementId;
$aParams['market_ads_include'] = true;
$aAds = Admin_DA::getAds($aParams);
// FIXME
$aLinkedAds = Admin_DA::getAdZones(array('zone_id' => $zoneId), false, 'ad_id');
foreach ($aAds as $adId => $aAd) {
if (!isset($aLinkedAds[$adId])) {
$ret = Admin_DA::addAdZone(array('zone_id' => $zoneId, 'ad_id' => $adId));
if (PEAR::isError($ret)) {
return false;
}
}
}
return true;
}
// Get ad limitation parameters
function MAX_getLinkedAdParams($zoneId)
{
$aParams = array();
$aZone = Admin_DA::getZone($zoneId);
if ($aZone['type'] == phpAds_ZoneText) {
$aParams['ad_type'] = 'txt';
} else {
$aParams['ad_type'] = '!txt';
if ($aZone['width'] != -1) {
$aParams['ad_width'] = $aZone['width'];
}
if ($aZone['height'] != -1) {
$aParams['ad_height'] = $aZone['height'];
}
}
// Allow linking *x* banners
$aParams['ad_nosize'] = true;
return $aParams;
}
// +---------------------------------------+
// | file handling |
// +---------------------------------------+
/* REDUNDANT
function MAX_removeFile($adId)
{
$aAd = Admin_DA::getAd($adId);
_removeFile($aAd);
}
function MAX_removeFiles($aParams)
{
$aAds = Admin_DA::getAds($aParams);
foreach ($aAds as $aAd) {
_removeFile($aAd);
}
}
function _removeFile($aAd)
{
$conf = $GLOBALS['_MAX']['CONF'];
$pref = $GLOBALS['_MAX']['PREF'];
if (!empty($aAd['filename'])) {
if ($aAd['type'] == 'web') {
if ($phpAds_config['type_web_mode'] == 0) {
$fileName = "{$phpAds_config['type_web_dir']}/{$aAd['filename']}";
if (@file_exists($fileName)) {
@unlink ($fileName);
}
} else {
// FTP mode
$server = parse_url($phpAds_config['type_web_ftp']);
if ($server['path'] != '' && substr($server['path'], 0, 1) == '/') {
$server['path'] = substr ($server['path'], 1);
}
if ($server['scheme'] == 'ftp') {
$conn_id = @ftp_connect($server['host']);
if ($server['pass'] && $server['user'])
$login = @ftp_login ($conn_id, $server['user'], $server['pass']);
else
$login = @ftp_login ($conn_id, 'anonymous', $pref['admin_email']);
if (($conn_id) || ($login)) {
if ($server['path'] != '')
@ftp_chdir ($conn_id, $server['path']);
if (@ftp_size ($conn_id, $aAd['filename']) > 0) {
@ftp_delete ($conn_id, $aAd['filename']);
}
@ftp_quit($conn_id);
}
}
}
} elseif ($aAd['type'] == 'sql') {
Admin_DA::deleteImage($aAd['filename']);
}
}
}
*/
// +---------------------------------------+
// | Duplication functions |
// +---------------------------------------+
function MAX_duplicateAdZones($fromAdId, $toAdId) {
$aAdZones = Admin_DA::getAdZones(array('ad_id' => $fromAdId), true, 'zone_id');
if (!empty($aAdZones)) {
foreach ($aAdZones as $zoneId => $adId) {
Admin_DA::addAdZone(array('ad_id' => $toAdId, 'zone_id' => $zoneId));
}
}
}
function MAX_duplicatePlacementZones($fromPlacementId, $toPlacementId) {
$pAdZones = Admin_DA::getPlacementZones(array('placement_id' => $fromPlacementId), true, 'zone_id');
if (!empty($pAdZones)) {
foreach ($pAdZones as $zoneId => $placementId) {
Admin_DA::addPlacementZone(array('placement_id' => $toPlacementId, 'zone_id' => $zoneId), false);
}
}
}
?>
| gpl-2.0 |
ETSGlobal/ezpublish_built | lib/ezdbschema/classes/ezdbschema.php | 4306 | <?php
/**
* File containing the eZDbSchema class.
*
* @copyright Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version 2011.12
* @package lib
*/
/*!
\class eZDbSchema ezdbschema.php
\ingroup eZDbSchema
\brief A factory for schema handlers
*/
class eZDbSchema
{
/**
* Returns a shared instance of the eZDBSchemaInterface class.
*
* @param array|eZDBInterface|false $params If array, following key is needed:
* - instance: the eZDB instance (optional), if none provided, eZDB::instance() will be used.
* @return eZDBSchemaInterface|false
*/
static function instance( $params = false )
{
if ( is_object( $params ) )
{
$db = $params;
$params = array( 'instance' => $db );
}
if ( !isset( $params['instance'] ) )
{
$db = eZDB::instance();
$params['instance'] = $db;
}
$db = $params['instance'];
if ( !isset( $params['type'] ) )
$params['type'] = $db->databaseName();
if ( !isset( $params['schema'] ) )
$params['schema'] = false;
$dbname = $params['type'];
/* Load the database schema handler INI stuff */
$ini = eZINI::instance( 'dbschema.ini' );
$schemaPaths = $ini->variable( 'SchemaSettings', 'SchemaPaths' );
$schemaHandlerClasses = $ini->variable( 'SchemaSettings', 'SchemaHandlerClasses' );
/* Check if we have a handler */
if ( !isset( $schemaPaths[$dbname] ) or !isset( $schemaHandlerClasses[$dbname] ) )
{
eZDebug::writeError( "No schema handler for database type: $dbname", __METHOD__ );
return false;
}
/* Include the schema file and instantiate it */
require_once( $schemaPaths[$dbname] );
return new $schemaHandlerClasses[$dbname]( $params );
}
/*!
\static
*/
static function read( $filename, $returnArray = false )
{
$fd = @fopen( $filename, 'rb' );
if ( $fd )
{
$buf = fread( $fd, 100 );
fclose( $fd );
if ( preg_match( '#^<\?' . "php#", $buf ) )
{
include( $filename );
if ( $returnArray )
{
$params = array();
if ( isset( $schema ) )
$params['schema'] = $schema;
if ( isset( $data ) )
$params['data'] = $data;
return $params;
}
else
{
return $schema;
}
}
else if ( preg_match( '#a:[0-9]+:{#', $buf ) )
{
return unserialize( file_get_contents( $filename ) );
}
else
{
eZDebug::writeError( "Unknown format for file $filename" );
return false;
}
}
return false;
}
/*!
\static
*/
static function readArray( $filename )
{
$schema = false;
include( $filename );
return $schema;
}
/*!
\static
*/
static function generateUpgradeFile( $differences )
{
$diff = var_export( $differences, true );
return ( "<?php \n\$diff = \n" . $diff . ";\nreturn \$diff;\n?>\n" );
}
/*!
\static
*/
static function writeUpgradeFile( $differences, $filename )
{
$fp = @fopen( $filename, 'w' );
if ( $fp )
{
fputs( $fp, eZDbSchema::generateUpgradeFile( $differences ) );
fclose( $fp );
return true;
}
else
{
return false;
}
}
/**
* Merges 2 db schemas, basically appending 2nd on top of 1st
* @return array the merged schema
*/
static function merge( $schema1, $schema2 )
{
$merged = $schema1;
foreach( $schema2 as $tablename => $tabledef )
{
if ( $tablename != '_info' )
{
$merged[$tablename] = $tabledef;
}
}
return $merged;
}
}
?>
| gpl-2.0 |
vishwaAbhinav/OpenNMS | opennms-webapp/src/main/java/org/opennms/web/controller/EditProvisioningGroupController.java | 13416 | /*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2006-2012 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2012 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.web.controller;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.opennms.core.utils.LogUtils;
import org.opennms.netmgt.model.PrimaryType;
import org.opennms.netmgt.provision.persist.requisition.Requisition;
import org.opennms.web.svclayer.ManualProvisioningService;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;
/**
* <p>EditProvisioningGroupController class.</p>
*/
public class EditProvisioningGroupController extends SimpleFormController {
public static class TreeCommand {
private String m_formPath;
private String m_action;
private Requisition m_formData;
private String m_currentNode;
private String m_groupName = "hardcoded";
public String getAction() {
return m_action;
}
public void setAction(String action) {
m_action = action;
}
public String getGroupName() {
return m_groupName;
}
public void setGroupName(String groupName) {
m_groupName = groupName;
}
public Requisition getFormData() {
return m_formData;
}
public void setFormData(final Requisition importData) {
m_formData = importData;
}
public String getFormPath() {
return m_formPath;
}
public void setFormPath(String target) {
m_formPath = target;
}
public String getCurrentNode() {
return m_currentNode;
}
public void setCurrentNode(String node) {
m_currentNode = node;
}
public String getDataPath() {
//added nodeEditForm. to the formData. because somehow we are getting that attached a prefix as well.
return m_formPath.substring("nodeEditForm.formData.".length());
}
public void setDataPath(String path) {
//added nodeEditForm. to the formData. because somehow we are getting that attached a prefix as well.
m_formPath = "nodeEditForm.formData."+path;
}
public String toString() {
return new ToStringBuilder(this)
.append("action", getAction())
.append("currentNode", getCurrentNode())
.append("dataPath", getDataPath())
.append("formData", getFormData())
.append("formPath", getFormPath())
.append("groupName", getGroupName())
.toString();
}
}
private ManualProvisioningService m_provisioningService;
/**
* <p>setProvisioningService</p>
*
* @param provisioningService a {@link org.opennms.web.svclayer.ManualProvisioningService} object.
*/
public void setProvisioningService(ManualProvisioningService provisioningService) {
m_provisioningService = provisioningService;
}
/** {@inheritDoc} */
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
return super.handleRequestInternal(request, response);
}
/** {@inheritDoc} */
@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
TreeCommand treeCmd = (TreeCommand)command;
String action = treeCmd.getAction();
if (action == null) {
return doShow(request, response, treeCmd, errors);
} else if ("addNode".equalsIgnoreCase(action)) {
return doAddNode(request, response, treeCmd, errors);
} else if ("addInterface".equalsIgnoreCase(action)) {
return doAddInterface(request, response, treeCmd, errors);
} else if ("addService".equalsIgnoreCase(action)) {
return doAddService(request, response, treeCmd, errors);
} else if ("addCategory".equalsIgnoreCase(action)) {
return doAddCategory(request, response, treeCmd, errors);
} else if ("addAssetField".equalsIgnoreCase(action)) {
return doAddAssetField(request, response, treeCmd, errors);
} else if ("save".equalsIgnoreCase(action)) {
return doSave(request, response, treeCmd, errors);
} else if ("edit".equalsIgnoreCase(action)) {
return doEdit(request, response, treeCmd, errors);
} else if ("cancel".equalsIgnoreCase(action)) {
return doCancel(request, response, treeCmd, errors);
} else if ("delete".equalsIgnoreCase(action)) {
return doDelete(request, response, treeCmd, errors);
} else if ("import".equalsIgnoreCase(action)) {
return doImport(request, response, treeCmd, errors);
} else if ("done".equalsIgnoreCase(action)) {
return done(request, response, treeCmd, errors);
} else {
errors.reject("Unrecognized action: "+action);
return showForm(request, response, errors);
}
}
private ModelAndView done(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
return new ModelAndView(getSuccessView());
}
private ModelAndView doShow(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
return showForm(request, response, errors);
}
private ModelAndView doCancel(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
Requisition formData = m_provisioningService.getProvisioningGroup(treeCmd.getGroupName());
treeCmd.setFormData(formData);
treeCmd.setCurrentNode("");
return showForm(request, response, errors);
}
private ModelAndView doImport(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
m_provisioningService.importProvisioningGroup(treeCmd.getGroupName());
return super.showForm(request, response, errors);
}
private ModelAndView doDelete(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
Requisition formData = m_provisioningService.deletePath(treeCmd.getGroupName(), treeCmd.getDataPath());
treeCmd.setFormData(formData);
return showForm(request, response, errors);
}
private ModelAndView doAddCategory(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
Requisition formData = m_provisioningService.addCategoryToNode(treeCmd.getGroupName(), treeCmd.getDataPath(), "New Category");
treeCmd.setFormData(formData);
treeCmd.setCurrentNode(treeCmd.getFormPath()+".category[0]");
return showForm(request, response, errors);
}
private ModelAndView doAddAssetField(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
Requisition formData = m_provisioningService.addAssetFieldToNode(treeCmd.getGroupName(), treeCmd.getDataPath(), "key", "value");
treeCmd.setFormData(formData);
treeCmd.setCurrentNode(treeCmd.getFormPath()+".asset[0]");
return showForm(request, response, errors);
}
private ModelAndView doEdit(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
treeCmd.setCurrentNode(treeCmd.getFormPath());
return showForm(request, response, errors);
}
private ModelAndView doSave(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
try {
LogUtils.debugf(this, "treeCmd = %s", treeCmd);
treeCmd.getFormData().validate();
final Requisition formData = m_provisioningService.saveProvisioningGroup(treeCmd.getGroupName(), treeCmd.getFormData());
treeCmd.setFormData(formData);
treeCmd.setCurrentNode("");
} catch (final Throwable t) {
errors.reject(t.getMessage());
}
return showForm(request, response, errors);
}
private ModelAndView doAddService(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
Requisition formData = m_provisioningService.addServiceToInterface(treeCmd.getGroupName(), treeCmd.getDataPath(), "SVC");
treeCmd.setFormData(formData);
treeCmd.setCurrentNode(treeCmd.getFormPath()+".monitoredService[0]");
return showForm(request, response, errors);
}
private ModelAndView doAddInterface(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
Requisition formData = m_provisioningService.addInterfaceToNode(treeCmd.getGroupName(), treeCmd.getDataPath(), "");
treeCmd.setFormData(formData);
treeCmd.setCurrentNode(treeCmd.getFormPath()+".interface[0]");
return showForm(request, response, errors);
}
private ModelAndView doAddNode(HttpServletRequest request, HttpServletResponse response, TreeCommand treeCmd, BindException errors) throws Exception {
treeCmd.setFormData(m_provisioningService.addNewNodeToGroup(treeCmd.getGroupName(), "New Node"));
treeCmd.setCurrentNode(treeCmd.getFormPath()+".node[0]");
return showForm(request, response, errors);
}
/** {@inheritDoc} */
@Override
protected Object formBackingObject(HttpServletRequest request) throws Exception {
TreeCommand formCommand = new TreeCommand();
initializeTreeCommand(request, formCommand);
return formCommand;
}
private void initializeTreeCommand(HttpServletRequest request, TreeCommand formCommand) throws Exception {
String groupName = request.getParameter("groupName");
if (groupName == null) {
throw new IllegalArgumentException("groupName required");
}
Requisition formData = m_provisioningService.getProvisioningGroup(groupName);
if (formData == null) {
formData = m_provisioningService.createProvisioningGroup(groupName);
}
formCommand.setFormData(formData);
}
/** {@inheritDoc} */
@Override
protected Map<String, Collection<String>> referenceData(HttpServletRequest request) throws Exception {
Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
// Fetch the list of possible values out of the Castor enumeration
List<String> choices = new ArrayList<String>();
for (PrimaryType type : PrimaryType.getAllTypes()) {
choices.add(type.getCode());
}
map.put("snmpPrimaryChoices", choices);
String groupName = request.getParameter("groupName");
if (groupName != null) {
List<String> services = new ArrayList<String>(m_provisioningService.getServiceTypeNames(groupName));
Collections.sort(services);
map.put("services", services);
}
List<String> categories = new ArrayList<String>(m_provisioningService.getNodeCategoryNames());
Collections.sort(categories);
List<String> assetFields = new ArrayList<String>(m_provisioningService.getAssetFieldNames());
Collections.sort(assetFields);
map.put("categories", categories);
map.put("assetFields", assetFields);
return map;
}
}
| gpl-2.0 |
LucinoOliveira/exemplos | curso/mod17-phpHtml/ex1-php.php | 673 | <?php
/*
* Curso de PHP
* Aluno: Lucino Gonzaga
* E-mail: lucino2@gmail.com
* Linguagem: PHP 5.6
* Módulo 17 - Utilizando PHP com HTML
* Acesso a variáveis de formulários em HTML
*/
?>
<html>
<body>
<?php
$nota = $_POST['nota'];
echo "A nota do aluno foi $nota";
echo "<br>";
if ( $nota < 60 ):
echo "Aluno REPROVADO";
elseif ( ($nota >= 60) and ($nota < 70) ):
echo "Aluno APROVADO com conceito D";
elseif ( ($nota >= 71) and ($nota < 80) ):
echo "Aluno APROVADO com conceito C";
elseif ( ($nota >= 81) and ($nota < 90) ):
echo "Aluno APROVADO com conceito B";
else:
echo "Aluno APROVADO com conceito A";
endif;
?>
</body>
</html>
| gpl-2.0 |
mviitanen/marsmod | mcp/temp/src/minecraft/net/minecraft/client/renderer/RenderSorter.java | 1178 | package net.minecraft.client.renderer;
import java.util.Comparator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.entity.EntityLivingBase;
public class RenderSorter implements Comparator {
private EntityLivingBase field_78945_a;
private static final String __OBFID = "CL_00000943";
public RenderSorter(EntityLivingBase p_i1241_1_) {
this.field_78945_a = p_i1241_1_;
}
public int compare(WorldRenderer p_compare_1_, WorldRenderer p_compare_2_) {
if(p_compare_1_.field_78927_l && !p_compare_2_.field_78927_l) {
return 1;
} else if(p_compare_2_.field_78927_l && !p_compare_1_.field_78927_l) {
return -1;
} else {
double var3 = (double)p_compare_1_.func_78912_a(this.field_78945_a);
double var5 = (double)p_compare_2_.func_78912_a(this.field_78945_a);
return var3 < var5?1:(var3 > var5?-1:(p_compare_1_.field_78937_s < p_compare_2_.field_78937_s?1:-1));
}
}
// $FF: synthetic method
public int compare(Object p_compare_1_, Object p_compare_2_) {
return this.compare((WorldRenderer)p_compare_1_, (WorldRenderer)p_compare_2_);
}
}
| gpl-2.0 |
sharpmachine/connielofgreen.com | wp-content/plugins/affiliate-royale/classes/views/shared/unknown_error.php | 70 | <h3><?php _e('An Unknown Error Occurred', 'affiliate-royale'); ?></h3> | gpl-2.0 |
kralf/bouml | src/bin/java_generator/UmlArtifact.cpp | 8091 | // *************************************************************************
//
// Copyright 2004-2010 Bruno PAGES .
//
// This file is part of the BOUML Uml Toolkit.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// e-mail : bouml@free.fr
// home : http://bouml.free.fr
//
// *************************************************************************
#include <stdio.h>
#include <q3textstream.h>
//Added by qt3to4:
#include <Q3CString>
#include <QTextOStream>
#include "UmlArtifact.h"
#include "UmlPackage.h"
#include "UmlOperation.h"
#include "UmlClass.h"
#include "JavaSettings.h"
#include "UmlCom.h"
#include "util.h"
UmlPackage * UmlArtifact::package_of_generated_artifact;
UmlArtifact * UmlArtifact::current;
void UmlArtifact::generate() {
if (! managed) {
managed = TRUE;
if (stereotype() == "text") {
generate_text();
return;
}
else if (stereotype() != "source")
return;
package_of_generated_artifact = package();
current = this;
const Q3CString filedef = javaSource();
if (filedef.isEmpty())
return;
const Q3CString & name = this->name();
Q3CString path = package_of_generated_artifact->file_path(name);
UmlCom::message(name);
if (verbose())
UmlCom::trace(Q3CString("<hr><font face=helvetica>Generate code for <i> ")
+ name + "</i> in " + path + "</i></font><br>");
else
set_trace_header(Q3CString("<font face=helvetica>Generate code for <i> ")
+ name + "</i> in " + path + "</i></font><br>");
// get bodies if preserve
const Q3PtrVector<UmlClass> & cls = associatedClasses();
if (preserve())
UmlOperation::read_bodies(path);
// generate file
unsigned n = cls.count();
unsigned index;
Q3CString incl;
QByteArray file;
// note : QTextOStream(FILE *) does not work under windows
QTextOStream f(&file); // [lgfreitas] it expects a pointer to a byte array...
const char * p = filedef;
const char * pp = 0;
for (;;) {
if (*p == 0) {
if (pp == 0)
break;
// comment management done
p = pp;
pp = 0;
if (*p == 0)
break;
}
if (*p == '@')
manage_alias(p, f);
else if (*p != '$')
f << *p++;
else if (!strncmp(p, "${comment}", 10))
manage_comment(p, pp, JavaSettings::isGenerateJavadocStyleComment());
else if (!strncmp(p, "${description}", 14))
manage_description(p, pp);
else if (!strncmp(p, "${name}", 7)) {
p += 7;
f << name;
}
else if (!strncmp(p, "${Name}", 7)) {
p += 7;
f << capitalize(name);
}
else if (!strncmp(p, "${NAME}", 7)) {
p += 7;
f << name.upper();
}
else if (!strncmp(p, "${nAME}", 7)) {
p += 7;
f << name.lower();
}
else if (!strncmp(p, "${imports}", 10)) {
Q3CString indent = current_indent(p, filedef);
for (index = 0; index != n; index += 1)
cls[index]->generate_import(f, indent);
p += 10;
if (*p == '\n')
p += 1;
}
else if (!strncmp(p, "${package}", 10)) {
p += 10;
const Q3CString & package = package_of_generated_artifact->javaPackage();
if (!package.isEmpty())
f << "package " << package << ";\n\n";
if (*p == '\n')
p += 1;
}
else if (!strncmp(p, "${definition}", 13)) {
Q3CString indent = current_indent(p, filedef);
for (index = 0; index != n; index += 1)
cls[index]->generate(f, indent);
p += 13;
if (*p == '\n')
p += 1;
}
else
// strange
f << *p++;
}
f << '\000';
if (must_be_saved(path, file)) {
write_trace_header();
FILE * fp;
if ((fp = fopen((const char *) path, "wb")) == 0) {
write_trace_header();
UmlCom::trace(Q3CString("<font color=\"red\"><b><i> ")
+ name + "</i> : cannot open <i> "
+ path + "</i>, edit the <i> generation settings</i> (tab directory) or the <i>"
+ package_of_generated_artifact->name()
+ "</i> Java directory specification</b></font><br>");
incr_error();
}
else {
fputs((const char *) file, fp);
fclose(fp);
}
}
else if (get_trace_header().isEmpty())
UmlCom::trace(Q3CString("<font face=helvetica><i> ")
+ path + "</i> not modified</font><br>");
if (imports != 0) {
delete imports;
imports = 0;
}
}
}
void UmlArtifact::generate_text() {
const Q3CString srcdef = javaSource();
if (srcdef.isEmpty()) {
if (verbose())
UmlCom::trace(Q3CString("<hr><font face=helvetica>artifact <i>")
+ name() + "</i> has an empty Java definition</font><br>");
return;
}
UmlPackage * pack = package();
const Q3CString & name = UmlArtifact::name();
Q3CString src_path = pack->text_path(name);
Q3CString s = " in <i> " + src_path + "</i>";
UmlCom::message(name);
if (verbose())
UmlCom::trace(Q3CString("<hr><font face=helvetica>Generate code for <i> ")
+ name + "</i>" + s + "</font><br>");
else
set_trace_header(Q3CString("<font face=helvetica>Generate code for <i> ")
+ name + "</i>" + s + "</font><br>");
if (must_be_saved(src_path, (const char *) srcdef)) {
write_trace_header();
FILE * fp_src;
if ((fp_src = fopen((const char *) src_path, "wb")) == 0) {
write_trace_header();
UmlCom::trace(Q3CString("<font color=\"red\"><b><i> ")
+ name + " : </i> cannot open <i> "
+ src_path + "</i>, edit the <i> generation settings</i> (tab directory) or the <i>"
+ pack->name() + "</i> Java directory specification</b></font><br>");
incr_error();
}
else {
fputs((const char *) srcdef, fp_src);
fclose(fp_src);
}
}
else if (get_trace_header().isEmpty())
UmlCom::trace(Q3CString("<font face=helvetica><i> ")
+ src_path + "</i> not modified</font><br>");
}
UmlPackage * UmlArtifact::generation_package()
{
return package_of_generated_artifact;
}
UmlArtifact * UmlArtifact::generated_one()
{
return current;
}
void UmlArtifact::imported(const Q3CString & s) {
if (imports == 0)
// init it
(void) is_imported("", "");
imports->insert(s, this);
}
bool UmlArtifact::is_imported(const Q3CString & s) {
if (imports == 0)
// init it
(void) is_imported("", "");
return (imports->find(s) != 0);
}
bool UmlArtifact::is_imported(Q3CString path, Q3CString class_name) {
if (imports == 0) {
imports = new Q3AsciiDict<UmlArtifact>(17);
Q3CString s = javaSource();
int index = 0;
while ((index = s.find("import", index)) != -1) {
if ((index == 0) || (s[index - 1] < ' ')) {
int index2 = index + 6;
while ((s[index2] == ' ') || (s[index2] == '\t'))
index2 += 1;
if ((index2 != (index + 6)) &&
((index = s.find(';', index2)) != -1) &&
(index != index2)) {
Q3CString p = s.mid(index2, index - index2);
imports->insert(p, this);
}
else
index = index2;
}
else
index += 6;
}
}
return ((imports->find(path + '.' + class_name) != 0) ||
(imports->find(path + ".*") != 0));
}
bool UmlArtifact::must_be_saved(const char * path, const char * new_contains)
{
FILE * fp = fopen(path, "rb");
if (fp == 0)
return TRUE;
int c;
while ((c = fgetc(fp)) != EOF) {
if (((char) c) != *new_contains++) {
fclose(fp);
return TRUE;
}
}
fclose(fp);
return *new_contains != 0;
}
| gpl-2.0 |
dederobert/CPOA-Projet | FichePaie/src/appli/vue/FichePaie.java | 813 | package appli.vue;
import java.awt.Dimension;
import javax.swing.JFrame;
import appli.vue.panels.PanelFichePaie;
public class FichePaie extends JFrame{
private static final long serialVersionUID = 1L;
private static PanelFichePaie panel = new PanelFichePaie();
public FichePaie(String nom, String prenom) {
this.setTitle("Fiche de paie de " + nom + " " + prenom);
this.setSize(new Dimension(500, 300));
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
this.setLocationRelativeTo(null);
panel.setIdentite("M(me). " + nom.toUpperCase() + " " + prenom);
this.add(panel);
this.setVisible(true);
}
public PanelFichePaie getPanel() {
return panel;
}
public static void setPanel(PanelFichePaie panel) {
FichePaie.panel = panel;
}
}
| gpl-2.0 |
Simpler1/ZoneMinder | web/skins/classic/views/js/zone.js | 26971 | function validateForm( form ) {
var errors = new Array();
if ( selfIntersecting ) {
errors[errors.length] = selfIntersectingString;
}
if ( form.elements['newZone[Type]'].value != 'Inactive' && form.elements['newZone[Type]'].value != 'Privacy' ) {
if ( !form.newAlarmRgbR.value || !form.newAlarmRgbG.value || !form.newAlarmRgbB.value ) {
errors[errors.length] = alarmRGBUnsetString;
}
form.elements['newZone[AlarmRGB]'].value = (form.newAlarmRgbR.value<<16)|(form.newAlarmRgbG.value<<8)|form.newAlarmRgbB.value;
if ( !form.elements['newZone[MinPixelThreshold]'].value || (parseInt(form.elements['newZone[MinPixelThreshold]'].value) <= 0 ) ) {
errors[errors.length] = minPixelThresUnsetString;
} else if ( (parseInt(form.elements['newZone[MinPixelThreshold]'].value) >= parseInt(form.elements['newZone[MaxPixelThreshold]'].value)) && (parseInt(form.elements['newZone[MaxPixelThreshold]'].value) > 0) ) {
errors[errors.length] = minPixelThresLtMaxString;
}
if ( form.elements['newZone[CheckMethod]'].value == 'FilteredPixels' || form.elements['newZone[CheckMethod]'].value == 'Blobs' ) {
if ( !form.elements['newZone[FilterX]'].value || !form.elements['newZone[FilterY]'].value ) {
errors[errors.length] = filterUnsetString;
}
}
if ( !form.elements['newZone[MinAlarmPixels]'].value || (parseFloat(form.elements['newZone[MinAlarmPixels]'].value) <= 0 ) ) {
errors[errors.length] = minAlarmAreaUnsetString;
} else if ( (parseFloat(form.elements['newZone[MinAlarmPixels]'].value) >= parseFloat(form.elements['newZone[MaxAlarmPixels]'].value)) && (parseFloat(form.elements['newZone[MaxAlarmPixels]'].value) > 0) ) {
errors[errors.length] = minAlarmAreaLtMaxString;
}
if ( form.elements['newZone[CheckMethod]'].value == 'FilteredPixels' || form.elements['newZone[CheckMethod]'].value == 'Blobs' ) {
if ( !form.elements['newZone[MinFilterPixels]'].value || (parseFloat(form.elements['newZone[MinFilterPixels]'].value) <= 0 ) ) {
errors[errors.length] = minFilterAreaUnsetString;
} else if ( (parseFloat(form.elements['newZone[MinFilterPixels]'].value) >= parseFloat(form.elements['newZone[MaxFilterPixels]'].value)) && (parseFloat(form.elements['newZone[MaxFilterPixels]'].value) > 0) ) {
errors[errors.length] = minFilterAreaLtMaxString;
} else if ( parseFloat(form.elements['newZone[MinAlarmPixels]'].value) < parseFloat(form.elements['newZone[MinFilterPixels]'].value) ) {
errors[errors.length] = minFilterLtMinAlarmString;
}
if ( form.elements['newZone[CheckMethod]'].value == 'Blobs' ) {
if ( !form.elements['newZone[MinBlobPixels]'].value || (parseFloat(form.elements['newZone[MinBlobPixels]'].value) <= 0 ) ) {
errors[errors.length] = minBlobAreaUnsetString;
} else if ( (parseFloat(form.elements['newZone[MinBlobPixels]'].value) >= parseFloat(form.elements['newZone[MaxBlobPixels]'].value)) && (parseFloat(form.elements['newZone[MaxBlobPixels]'].value) > 0) ) {
errors[errors.length] = minBlobAreaLtMaxString;
} else if ( parseFloat(form.elements['newZone[MinFilterPixels]'].value) < parseFloat(form.elements['newZone[MinBlobPixels]'].value) ) {
errors[errors.length] = minBlobLtMinFilterString;
}
if ( !form.elements['newZone[MinBlobs]'].value || (parseInt(form.elements['newZone[MinBlobs]'].value) <= 0 ) ) {
errors[errors.length] = minBlobsUnsetString;
} else if ( (parseInt(form.elements['newZone[MinBlobs]'].value) >= parseInt(form.elements['newZone[MaxBlobs]'].value)) && (parseInt(form.elements['newZone[MaxBlobs]'].value) > 0) ) {
errors[errors.length] = minBlobsLtMaxString;
}
}
}
}
if ( errors.length ) {
alert( errors.join( "\n" ) );
return false;
}
return true;
}
function submitForm( form ) {
form.elements['newZone[AlarmRGB]'].value = (form.newAlarmRgbR.value<<16)|(form.newAlarmRgbG.value<<8)|form.newAlarmRgbB.value;
form.elements['newZone[NumCoords]'].value = zone['Points'].length;
form.elements['newZone[Coords]'].value = getCoordString();
form.elements['newZone[Area]'].value = zone.Area;
form.submit();
}
function applyZoneType() {
var form = document.zoneForm;
if ( form.elements['newZone[Type]'].value == 'Inactive' || form.elements['newZone[Type]'].value == 'Privacy' ) {
form.presetSelector.disabled = true;
form.newAlarmRgbR.disabled = true;
form.newAlarmRgbG.disabled = true;
form.newAlarmRgbB.disabled = true;
form.elements['newZone[CheckMethod]'].disabled = true;
form.elements['newZone[MinPixelThreshold]'].disabled = true;
form.elements['newZone[MaxPixelThreshold]'].disabled = true;
form.elements['newZone[MinAlarmPixels]'].disabled = true;
form.elements['newZone[MaxAlarmPixels]'].disabled = true;
form.elements['newZone[FilterX]'].disabled = true;
form.elements['newZone[FilterY]'].disabled = true;
form.elements['newZone[MinFilterPixels]'].disabled = true;
form.elements['newZone[MaxFilterPixels]'].disabled = true;
form.elements['newZone[MinBlobPixels]'].disabled = true;
form.elements['newZone[MaxBlobPixels]'].disabled = true;
form.elements['newZone[MinBlobs]'].disabled = true;
form.elements['newZone[MaxBlobs]'].disabled = true;
form.elements['newZone[OverloadFrames]'].disabled = true;
form.elements['newZone[ExtendAlarmFrames]'].disabled = true;
} else if ( form.elements['newZone[Type]'].value == 'Preclusive' ) {
form.presetSelector.disabled = false;
form.newAlarmRgbR.disabled = true;
form.newAlarmRgbG.disabled = true;
form.newAlarmRgbB.disabled = true;
form.elements['newZone[CheckMethod]'].disabled = false;
form.elements['newZone[MinPixelThreshold]'].disabled = false;
form.elements['newZone[MaxPixelThreshold]'].disabled = false;
form.elements['newZone[MinAlarmPixels]'].disabled = false;
form.elements['newZone[MaxAlarmPixels]'].disabled = false;
form.elements['newZone[OverloadFrames]'].disabled = false;
form.elements['newZone[ExtendAlarmFrames]'].disabled = false;
applyCheckMethod();
} else {
form.presetSelector.disabled = false;
form.newAlarmRgbR.disabled = false;
form.newAlarmRgbG.disabled = false;
form.newAlarmRgbB.disabled = false;
form.elements['newZone[CheckMethod]'].disabled = false;
form.elements['newZone[MinPixelThreshold]'].disabled = false;
form.elements['newZone[MaxPixelThreshold]'].disabled = false;
form.elements['newZone[MinAlarmPixels]'].disabled = false;
form.elements['newZone[MaxAlarmPixels]'].disabled = false;
form.elements['newZone[OverloadFrames]'].disabled = false;
form.elements['newZone[ExtendAlarmFrames]'].disabled = true;
applyCheckMethod();
}
}
function applyCheckMethod() {
var form = document.zoneForm;
if ( form.elements['newZone[CheckMethod]'].value == 'AlarmedPixels' ) {
form.elements['newZone[FilterX]'].disabled = true;
form.elements['newZone[FilterY]'].disabled = true;
form.elements['newZone[MinFilterPixels]'].disabled = true;
form.elements['newZone[MaxFilterPixels]'].disabled = true;
form.elements['newZone[MinBlobPixels]'].disabled = true;
form.elements['newZone[MaxBlobPixels]'].disabled = true;
form.elements['newZone[MinBlobs]'].disabled = true;
form.elements['newZone[MaxBlobs]'].disabled = true;
} else if ( form.elements['newZone[CheckMethod]'].value == 'FilteredPixels' ) {
form.elements['newZone[FilterX]'].disabled = false;
form.elements['newZone[FilterY]'].disabled = false;
form.elements['newZone[MinFilterPixels]'].disabled = false;
form.elements['newZone[MaxFilterPixels]'].disabled = false;
form.elements['newZone[MinBlobPixels]'].disabled = true;
form.elements['newZone[MaxBlobPixels]'].disabled = true;
form.elements['newZone[MinBlobs]'].disabled = true;
form.elements['newZone[MaxBlobs]'].disabled = true;
} else {
form.elements['newZone[FilterX]'].disabled = false;
form.elements['newZone[FilterY]'].disabled = false;
form.elements['newZone[MinFilterPixels]'].disabled = false;
form.elements['newZone[MaxFilterPixels]'].disabled = false;
form.elements['newZone[MinBlobPixels]'].disabled = false;
form.elements['newZone[MaxBlobPixels]'].disabled = false;
form.elements['newZone[MinBlobs]'].disabled = false;
form.elements['newZone[MaxBlobs]'].disabled = false;
}
}
function applyPreset() {
var form = document.zoneForm;
var presetId = $('presetSelector').get('value');
if ( presets[presetId] ) {
var preset = presets[presetId];
form.elements['newZone[Units]'].selectedIndex = preset['UnitsIndex'];
form.elements['newZone[CheckMethod]'].selectedIndex = preset['CheckMethodIndex'];
form.elements['newZone[MinPixelThreshold]'].value = preset['MinPixelThreshold'];
form.elements['newZone[MaxPixelThreshold]'].value = preset['MaxPixelThreshold'];
form.elements['newZone[FilterX]'].value = preset['FilterX'];
form.elements['newZone[FilterY]'].value = preset['FilterY'];
form.elements['newZone[MinAlarmPixels]'].value = preset['MinAlarmPixels'];
form.elements['newZone[MaxAlarmPixels]'].value = preset['MaxAlarmPixels'];
form.elements['newZone[MinFilterPixels]'].value = preset['MinFilterPixels'];
form.elements['newZone[MaxFilterPixels]'].value = preset['MaxFilterPixels'];
form.elements['newZone[MinBlobPixels]'].value = preset['MinBlobPixels'];
form.elements['newZone[MaxBlobPixels]'].value = preset['MaxBlobPixels'];
form.elements['newZone[MinBlobs]'].value = preset['MinBlobs'];
form.elements['newZone[MaxBlobs]'].value = preset['MaxBlobs'];
form.elements['newZone[OverloadFrames]'].value = preset['OverloadFrames'];
form.elements['newZone[ExtendAlarmFrames]'].value = preset['ExtendAlarmFrames'];
applyCheckMethod();
form.elements['newZone[TempArea]'].value = 100;
}
}
function toPixels( field, maxValue ) {
if ( field.value != '' ) {
field.value = Math.round((field.value*maxValue)/100);
}
}
function toPercent( field, maxValue ) {
if ( field.value != '' ) {
field.value = Math.round((100*100*field.value)/maxValue)/100;
}
}
function applyZoneUnits() {
var area = zone.Area;
var form = document.zoneForm;
if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
form.elements['newZone[TempArea]'].value = area;
toPixels( form.elements['newZone[MinAlarmPixels]'], area );
toPixels( form.elements['newZone[MaxAlarmPixels]'], area );
toPixels( form.elements['newZone[MinFilterPixels]'], area );
toPixels( form.elements['newZone[MaxFilterPixels]'], area );
toPixels( form.elements['newZone[MinBlobPixels]'], area );
toPixels( form.elements['newZone[MaxBlobPixels]'], area );
} else {
form.elements['newZone[TempArea]'].value = Math.round( area/monitorArea * 100 );
toPercent( form.elements['newZone[MinAlarmPixels]'], area );
toPercent( form.elements['newZone[MaxAlarmPixels]'], area );
toPercent( form.elements['newZone[MinFilterPixels]'], area );
toPercent( form.elements['newZone[MaxFilterPixels]'], area );
toPercent( form.elements['newZone[MinBlobPixels]'], area );
toPercent( form.elements['newZone[MaxBlobPixels]'], area );
}
}
function limitRange( field, minValue, maxValue ) {
if ( field.value != '' ) {
field.value = constrainValue( parseInt(field.value), parseInt(minValue), parseInt(maxValue) );
}
}
function limitFilter( field ) {
field.value = (Math.floor((field.value-1)/2)*2) + 1;
field.value = constrainValue(parseInt(field.value), 3, 15);
}
function limitArea( field ) {
var minValue = 0;
var maxValue = zone.Area;
if ( document.zoneForm.elements['newZone[Units]'].value == "Percent" ) {
maxValue = 100;
}
limitRange( field, minValue, maxValue );
}
function highlightOn( index ) {
$('row'+index).addClass( 'highlight' );
$('point'+index).addClass( 'highlight' );
}
function highlightOff( index ) {
$('row'+index).removeClass( 'highlight' );
$('point'+index).removeClass( 'highlight' );
}
function setActivePoint( index ) {
highlightOff( index );
$('row'+index).addClass( 'active' );
$('point'+index).addClass( 'active' );
}
function unsetActivePoint( index ) {
$('row'+index).removeClass( 'active' );
$('point'+index).removeClass( 'active' );
}
function getCoordString() {
var coords = new Array();
for ( var i = 0; i < zone['Points'].length; i++ ) {
coords[coords.length] = zone['Points'][i].x+','+zone['Points'][i].y;
}
return ( coords.join( " " ) );
}
function updateZoneImage() {
var SVG = $('zoneSVG');
var Poly = $('zonePoly');
Poly.points.clear();
for ( var i = 0; i < zone['Points'].length; i++ ) {
var Point = SVG.createSVGPoint();
Point.x = zone['Points'][i].x;
Point.y = zone['Points'][i].y;
Poly.points.appendItem( Point );
}
}
function fixActivePoint( index ) {
updateActivePoint( index );
unsetActivePoint( index );
updateZoneImage();
}
function constrainValue( value, loVal, hiVal ) {
if ( value < loVal ) {
return loVal;
}
if ( value > hiVal ) {
return hiVal;
}
return value;
}
function updateActivePoint( index ) {
var point = $('point'+index);
var x = constrainValue( point.getStyle( 'left' ).toInt(), 0, maxX );
var y = constrainValue( point.getStyle( 'top' ).toInt(), 0, maxY );
$('newZone[Points]['+index+'][x]').value = x;
$('newZone[Points]['+index+'][y]').value = y;
zone['Points'][index].x = x;
zone['Points'][index].y = y;
var Point = $('zonePoly').points.getItem(index);
Point.x =x;
Point.y =y;
updateArea();
}
function addPoint( index ) {
var nextIndex = index+1;
if ( index >= (zone['Points'].length-1) ) {
nextIndex = 0;
}
var newX = parseInt(Math.round((zone['Points'][index]['x']+zone['Points'][nextIndex]['x'])/2));
var newY = parseInt(Math.round((zone['Points'][index]['y']+zone['Points'][nextIndex]['y'])/2));
if ( nextIndex == 0 ) {
zone['Points'][zone['Points'].length] = {'x': newX, 'y': newY};
} else {
zone['Points'].splice( nextIndex, 0, {'x': newX, 'y': newY} );
}
drawZonePoints();
// drawZonePoints calls updateZoneImage
//updateZoneImage();
//setActivePoint( nextIndex );
}
function delPoint( index ) {
zone['Points'].splice( index, 1 );
drawZonePoints();
}
function limitPointValue( point, loVal, hiVal ) {
point.value = constrainValue(point.value, loVal, hiVal);
}
function updateArea( ) {
area = Polygon_calcArea(zone['Points']);
zone.Area = area;
var form = $('zoneForm');
form.elements['newZone[Area]'].value = area;
if ( form.elements['newZone[Units]'].value == 'Percent' ) {
form.elements['newZone[TempArea]'].value = Math.round( area/monitorArea*100 );
} else if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
form.elements['newZone[TempArea]'].value = area;
} else {
alert("Unknown units: " + form.elements['newZone[Units]'].value);
}
}
function updateX( index ) {
limitPointValue( $('newZone[Points]['+index+'][x]'), 0, maxX );
var point = $('point'+index);
var x = $('newZone[Points]['+index+'][x]').get('value');
point.setStyle( 'left', x+'px' );
zone['Points'][index].x = x;
var Point = $('zonePoly').points.getItem(index);
Point.x = x;
updateArea();
}
function updateY( index ) {
limitPointValue( $('newZone[Points]['+index+'][y]'), 0, maxY );
var point = $('point'+index);
var y = $('newZone[Points]['+index+'][y]').get('value');
point.setStyle( 'top', y+'px' );
zone['Points'][index].y = y;
var Point = $('zonePoly').points.getItem(index);
Point.y = y;
updateArea();
}
function saveChanges( element ) {
var form = element.form;
if ( validateForm(form) ) {
submitForm(form);
if ( form.elements['newZone[Type]'].value == 'Privacy' ) {
alert( 'Capture process for this monitor will be restarted for the Privacy zone changes to take effect.' );
}
return true;
}
return false;
}
function drawZonePoints() {
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) {
element.destroy();
} );
for ( var i = 0; i < zone['Points'].length; i++ ) {
var div = new Element( 'div', {
'id': 'point'+i,
'class': 'zonePoint',
'title': 'Point '+(i+1),
'styles': {
'left': zone['Points'][i].x,
'top': zone['Points'][i].y
}
} );
div.addEvent( 'mouseover', highlightOn.pass( i ) );
div.addEvent( 'mouseout', highlightOff.pass( i ) );
div.inject( $('imageFrame') );
div.makeDraggable( {
'container': $('imageFrame'),
'onStart': setActivePoint.pass( i ),
'onComplete': fixActivePoint.pass( i ),
'onDrag': updateActivePoint.pass( i )
} );
}
var tables = $('zonePoints').getElements( 'table' );
tables.each( function( table ) {
table.getElement( 'tbody' ).empty();
} );
for ( var i = 0; i < zone['Points'].length; i++ ) {
var row = new Element( 'tr', {'id': 'row'+i} );
row.addEvents( {'mouseover': highlightOn.pass( i ), 'mouseout': highlightOff.pass( i )} );
var cell = new Element( 'td' );
cell.set( 'text', i+1 );
cell.inject( row );
cell = new Element( 'td' );
var input = new Element( 'input', {'id': 'newZone[Points]['+i+'][x]', 'name': 'newZone[Points]['+i+'][x]', 'value': zone['Points'][i].x, 'size': 5} );
input.addEvent( 'input', updateX.pass( i ) );
input.inject( cell );
cell.inject( row );
cell = new Element( 'td' );
input = new Element( 'input', {'id': 'newZone[Points]['+i+'][y]', 'name': 'newZone[Points]['+i+'][y]', 'value': zone['Points'][i].y, 'size': 5} );
input.addEvent( 'input', updateY.pass( i ) );
input.inject( cell );
cell.inject( row );
cell = new Element( 'td' );
new Element( 'button', {
'type': 'button',
'events': {'click': addPoint.pass(i)}
}).set( 'text', '+' ).inject( cell );
if ( zone['Points'].length > 3 ) {
cell.appendText(' ');
new Element( 'button', {
'id': 'delete'+i,
'type': 'button',
'events': {'click': delPoint.pass(i)}
} ).set( 'text', '-' ).inject( cell );
}
cell.inject( row );
row.inject( tables[i%tables.length].getElement( 'tbody' ) );
}
// Sets up the SVG polygon
updateZoneImage();
}
//
// Imported from watch.js and modified for new zone edit view
//
var alarmState = STATE_IDLE;
var lastAlarmState = STATE_IDLE;
function setAlarmState( currentAlarmState ) {
alarmState = currentAlarmState;
var stateClass = "";
if ( alarmState == STATE_ALARM ) {
stateClass = "alarm";
} else if ( alarmState == STATE_ALERT ) {
stateClass = "alert";
}
$('stateValue').set( 'text', stateStrings[alarmState] );
if ( stateClass ) {
$('stateValue').setProperty( 'class', stateClass );
} else {
$('stateValue').removeProperty( 'class' );
}
var isAlarmed = ( alarmState == STATE_ALARM || alarmState == STATE_ALERT );
var wasAlarmed = ( lastAlarmState == STATE_ALARM || lastAlarmState == STATE_ALERT );
var newAlarm = ( isAlarmed && !wasAlarmed );
var oldAlarm = ( !isAlarmed && wasAlarmed );
if ( newAlarm ) {
if ( SOUND_ON_ALARM ) {
// Enable the alarm sound
if ( !canPlayPauseAudio ) {
$('alarmSound').removeClass( 'hidden' );
} else {
$('MediaPlayer').Play();
}
}
}
if ( SOUND_ON_ALARM ) {
if ( oldAlarm ) {
// Disable alarm sound
if ( !canPlayPauseAudio ) {
$('alarmSound').addClass( 'hidden' );
} else {
$('MediaPlayer').Stop();
}
}
}
lastAlarmState = alarmState;
}
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
if ( auth_hash ) {
streamCmdParms += '&auth='+auth_hash;
}
var streamCmdReq = new Request.JSON( {
url: monitorUrl,
method: 'get',
timeout: AJAX_TIMEOUT,
link: 'cancel',
onSuccess: getStreamCmdResponse
} );
var streamCmdTimer = null;
var streamStatus;
function getStreamCmdResponse( respObj, respText ) {
watchdogOk("stream");
if ( streamCmdTimer ) {
streamCmdTimer = clearTimeout( streamCmdTimer );
}
if ( respObj.result == 'Ok' ) {
streamStatus = respObj.status;
$('fpsValue').set( 'text', streamStatus.fps );
setAlarmState( streamStatus.state );
if ( streamStatus.paused == true ) {
streamCmdPause( false );
} else if ( streamStatus.delayed == true && streamStatus.rate == 1 ) {
streamCmdPlay( false );
}
} else {
checkStreamForErrors("getStreamCmdResponse", respObj);//log them
if ( ! streamPause ) {
// Try to reload the image stream.
var streamImg = $('liveStream'+monitorId);
if ( streamImg ) {
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
}
}
}
if ( ! streamPause ) {
var streamCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) {
streamCmdTimeout = streamCmdTimeout/5;
}
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
}
var streamPause = false;
function streamCmdPauseToggle() {
if ( streamPause == true ) {
streamCmdPlay( true );
streamPause = false;
document.getElementById("pauseBtn").value = pauseString;
} else {
streamCmdPause( true );
streamPause = true;
document.getElementById("pauseBtn").value = playString;
}
}
function streamCmdPause( action ) {
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAUSE );
}
}
function streamCmdPlay( action ) {
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
}
}
function streamCmdStop( action ) {
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_STOP );
}
}
function streamCmdQuery() {
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
}
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
if ( auth_hash ) {
statusCmdParms += '&auth='+auth_hash;
}
var statusCmdReq = new Request.JSON( {
url: monitorUrl,
method: 'get',
data: statusCmdParms,
timeout: AJAX_TIMEOUT,
link: 'cancel',
onSuccess: getStatusCmdResponse
} );
var statusCmdTimer = null;
function getStatusCmdResponse( respObj, respText ) {
watchdogOk("status");
if ( statusCmdTimer ) {
statusCmdTimer = clearTimeout( statusCmdTimer );
}
if ( respObj.result == 'Ok' ) {
$('fpsValue').set( 'text', respObj.monitor.FrameRate );
setAlarmState( respObj.monitor.Status );
} else {
checkStreamForErrors("getStatusCmdResponse", respObj);
}
if ( ! streamPause ) {
var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) {
statusCmdTimeout = statusCmdTimeout/5;
}
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
}
}
function statusCmdQuery() {
statusCmdReq.send();
}
function fetchImage( streamImage ) {
streamImage.src = streamImage.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
}
function appletRefresh() {
if ( streamStatus && (!streamStatus.paused && !streamStatus.delayed) ) {
var streamImg = $('liveStream');
var parent = streamImg.getParent();
streamImg.dispose();
streamImg.inject( parent );
if ( appletRefreshTime ) {
appletRefresh.delay( appletRefreshTime*1000 );
}
} else {
appletRefresh.delay( 15*1000 ); //if we are paused or delayed check every 15 seconds if we are live yet...
}
}
var watchdogInactive = {
'stream': false,
'status': false
};
var watchdogFunctions = {
'stream': streamCmdQuery,
'status': statusCmdQuery
};
//Make sure the various refreshes are still taking effect
function watchdogCheck( type ) {
if ( watchdogInactive[type] ) {
console.log( "Detected streamWatch of type: " + type + " stopped, restarting" );
watchdogFunctions[type]();
watchdogInactive[type] = false;
} else {
watchdogInactive[type] = true;
}
}
function watchdogOk( type ) {
watchdogInactive[type] = false;
}
function initPage() {
var form = document.zoneForm;
//form.elements['newZone[Name]'].disabled = true;
//form.elements['newZone[Type]'].disabled = true;
form.presetSelector.disabled = true;
//form.elements['newZone[Units]'].disabled = true;
form.newAlarmRgbR.disabled = true;
form.newAlarmRgbG.disabled = true;
form.newAlarmRgbB.disabled = true;
form.elements['newZone[CheckMethod]'].disabled = true;
form.elements['newZone[MinPixelThreshold]'].disabled = true;
form.elements['newZone[MaxPixelThreshold]'].disabled = true;
form.elements['newZone[MinAlarmPixels]'].disabled = true;
form.elements['newZone[MaxAlarmPixels]'].disabled = true;
form.elements['newZone[FilterX]'].disabled = true;
form.elements['newZone[FilterY]'].disabled = true;
form.elements['newZone[MinFilterPixels]'].disabled = true;
form.elements['newZone[MaxFilterPixels]'].disabled = true;
form.elements['newZone[MinBlobPixels]'].disabled = true;
form.elements['newZone[MaxBlobPixels]'].disabled = true;
form.elements['newZone[MinBlobs]'].disabled = true;
form.elements['newZone[MaxBlobs]'].disabled = true;
form.elements['newZone[OverloadFrames]'].disabled = true;
applyZoneType();
if ( form.elements['newZone[Units]'].value == 'Percent' ) {
applyZoneUnits();
}
applyCheckMethod();
drawZonePoints();
//
// Imported from watch.js and modified for new zone edit view
//
var delay = (Math.random()+0.1)*statusRefreshTimeout;
//console.log("Delay for status updates is: " + delay );
if ( streamMode == "single" ) {
statusCmdTimer = statusCmdQuery.delay( delay );
watchdogCheck.pass('status').periodical(statusRefreshTimeout*2);
} else {
streamCmdTimer = streamCmdQuery.delay( delay );
watchdogCheck.pass('stream').periodical(statusRefreshTimeout*2);
}
if ( canStreamNative || streamMode == "single" ) {
var streamImg = $('imageFrame').getElement('img');
if ( !streamImg ) {
streamImg = $('imageFrame').getElement('object');
}
if ( streamMode == "single" ) {
streamImg.addEvent( 'click', fetchImage.pass( streamImg ) );
fetchImage.pass( streamImg ).periodical( imageRefreshTimeout );
}
}
if ( refreshApplet && appletRefreshTime ) {
appletRefresh.delay( appletRefreshTime*1000 );
}
}
function Polygon_calcArea( coords ) {
var n_coords = coords.length;
var float_area = 0.0;
for ( i = 0; i < n_coords-1; i++ ) {
var trap_area = (coords[i].x*coords[i+1].y - coords[i+1].x*coords[i].y) / 2;
float_area += trap_area;
//printf( "%.2f (%.2f)\n", float_area, trap_area );
}
float_area += (coords[n_coords-1].x*coords[0].y - coords[0].x*coords[n_coords-1].y) / 2;
return Math.round( Math.abs( float_area ) );
}
window.addEventListener( 'DOMContentLoaded', initPage );
| gpl-2.0 |
FSteitz/KeePass | KeePass/Forms/UrlOverridesForm.cs | 6995 | /*
KeePass Password Safe - The Open-Source Password Manager
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using KeePass.App.Configuration;
using KeePass.Resources;
using KeePass.UI;
namespace KeePass.Forms
{
public partial class UrlOverridesForm : Form
{
private AceUrlSchemeOverrides m_aceOvr = null;
private AceUrlSchemeOverrides m_aceTmp = null;
private bool m_bEnfSch = false;
private bool m_bEnfAll = false;
private string m_strUrlOverrideAll = string.Empty;
public string UrlOverrideAll
{
get { return m_strUrlOverrideAll; }
}
public void InitEx(AceUrlSchemeOverrides aceOvr, string strOverrideAll)
{
m_aceOvr = aceOvr;
Debug.Assert(strOverrideAll != null);
m_strUrlOverrideAll = (strOverrideAll ?? string.Empty);
}
public UrlOverridesForm()
{
InitializeComponent();
Program.Translation.ApplyTo(this);
}
private void OnFormLoad(object sender, EventArgs e)
{
if(m_aceOvr == null) throw new InvalidOperationException();
m_aceTmp = m_aceOvr.CloneDeep();
GlobalWindowManager.AddWindow(this);
this.Icon = Properties.Resources.KeePass;
this.Text = KPRes.UrlOverrides;
UIUtil.SetExplorerTheme(m_lvOverrides, false);
int nWidth = m_lvOverrides.ClientSize.Width - UIUtil.GetVScrollBarWidth();
m_lvOverrides.Columns.Add(KPRes.Scheme, nWidth / 4);
m_lvOverrides.Columns.Add(KPRes.UrlOverride, (nWidth * 3) / 4);
m_bEnfSch = AppConfigEx.IsOptionEnforced(Program.Config.Integration, "UrlSchemeOverrides");
m_bEnfAll = AppConfigEx.IsOptionEnforced(Program.Config.Integration, "UrlOverride");
UpdateOverridesList(false, false);
m_cbOverrideAll.Checked = (m_strUrlOverrideAll.Length > 0);
m_tbOverrideAll.Text = m_strUrlOverrideAll;
EnableControlsEx();
}
private void OnFormClosed(object sender, FormClosedEventArgs e)
{
GlobalWindowManager.RemoveWindow(this);
}
private void UpdateOverridesList(bool bRestoreView, bool bUpdateState)
{
UIScrollInfo s = (bRestoreView ? UIUtil.GetScrollInfo(
m_lvOverrides, true) : null);
m_lvOverrides.BeginUpdate();
m_lvOverrides.Items.Clear();
m_lvOverrides.Groups.Clear();
for(int i = 0; i < 2; ++i)
{
List<AceUrlSchemeOverride> l = ((i == 0) ?
m_aceTmp.BuiltInOverrides : m_aceTmp.CustomOverrides);
ListViewGroup lvg = new ListViewGroup((i == 0) ?
KPRes.OverridesBuiltIn : KPRes.OverridesCustom);
m_lvOverrides.Groups.Add(lvg);
foreach(AceUrlSchemeOverride ovr in l)
{
ListViewItem lvi = new ListViewItem(ovr.Scheme);
lvi.SubItems.Add(ovr.UrlOverride);
lvi.Tag = ovr; // Set before setting the Checked property
lvi.Checked = ovr.Enabled;
m_lvOverrides.Items.Add(lvi);
lvg.Items.Add(lvi);
}
}
if(bRestoreView) UIUtil.Scroll(m_lvOverrides, s, false);
m_lvOverrides.EndUpdate();
if(bUpdateState) EnableControlsEx();
}
private void OnOverridesItemChecked(object sender, ItemCheckedEventArgs e)
{
AceUrlSchemeOverride ovr = (e.Item.Tag as AceUrlSchemeOverride);
if(ovr == null) { Debug.Assert(false); return; }
ovr.Enabled = e.Item.Checked;
}
private void EnableControlsEx()
{
bool bAll = m_cbOverrideAll.Checked;
m_cbOverrideAll.Enabled = !m_bEnfAll;
m_tbOverrideAll.Enabled = (!m_bEnfAll && bAll);
ListView.SelectedListViewItemCollection lvsc = m_lvOverrides.SelectedItems;
bool bOne = (lvsc.Count == 1);
bool bAtLeastOne = (lvsc.Count >= 1);
bool bBuiltIn = false;
foreach(ListViewItem lvi in lvsc)
{
AceUrlSchemeOverride ovr = (lvi.Tag as AceUrlSchemeOverride);
if(ovr == null) { Debug.Assert(false); continue; }
if(ovr.IsBuiltIn) { bBuiltIn = true; break; }
}
bool bSch = !m_bEnfSch;
m_lvOverrides.Enabled = bSch;
m_btnAdd.Enabled = bSch;
m_btnEdit.Enabled = (bSch && bOne && !bBuiltIn);
m_btnDelete.Enabled = (bSch && bAtLeastOne && !bBuiltIn);
}
private void OnOverridesSelectedIndexChanged(object sender, EventArgs e)
{
EnableControlsEx();
}
private void OnBtnAdd(object sender, EventArgs e)
{
AceUrlSchemeOverride ovr = new AceUrlSchemeOverride(true, string.Empty,
string.Empty);
UrlOverrideForm dlg = new UrlOverrideForm();
dlg.InitEx(ovr);
if(UIUtil.ShowDialogAndDestroy(dlg) == DialogResult.OK)
{
m_aceTmp.CustomOverrides.Add(ovr);
UpdateOverridesList(true, true);
// m_lvOverrides.EnsureVisible(m_lvOverrides.Items.Count - 1);
}
}
private void OnBtnEdit(object sender, EventArgs e)
{
ListView.SelectedListViewItemCollection lvsic = m_lvOverrides.SelectedItems;
if((lvsic == null) || (lvsic.Count != 1)) return;
AceUrlSchemeOverride ovr = (lvsic[0].Tag as AceUrlSchemeOverride);
if(ovr == null) { Debug.Assert(false); return; }
if(ovr.IsBuiltIn) { Debug.Assert(false); return; }
UrlOverrideForm dlg = new UrlOverrideForm();
dlg.InitEx(ovr);
if(UIUtil.ShowDialogAndDestroy(dlg) == DialogResult.OK)
UpdateOverridesList(true, true);
}
private void OnBtnDelete(object sender, EventArgs e)
{
ListView.SelectedListViewItemCollection lvsic = m_lvOverrides.SelectedItems;
if((lvsic == null) || (lvsic.Count == 0)) return;
foreach(ListViewItem lvi in lvsic)
{
AceUrlSchemeOverride ovr = (lvi.Tag as AceUrlSchemeOverride);
if(ovr == null) { Debug.Assert(false); continue; }
if(ovr.IsBuiltIn) { Debug.Assert(false); continue; }
try { m_aceTmp.CustomOverrides.Remove(ovr); }
catch(Exception) { Debug.Assert(false); }
}
UpdateOverridesList(true, true);
}
private void OnBtnOK(object sender, EventArgs e)
{
m_aceTmp.CopyTo(m_aceOvr);
if(m_cbOverrideAll.Checked)
m_strUrlOverrideAll = m_tbOverrideAll.Text;
else m_strUrlOverrideAll = string.Empty;
}
private void OnOverrideAllCheckedChanged(object sender, EventArgs e)
{
EnableControlsEx();
}
}
}
| gpl-2.0 |
johnson741/frogpond | wp-config.php | 3374 | <?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
* installation. You don't have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'vstudiod_wor2');
/** MySQL database username */
define('DB_USER', 'vstudiod_wor2');
/** MySQL database password */
define('DB_PASSWORD', 'CE2hm0sn');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', ':I:7MfZ@3kZyPltXs(lEQ}jmy^ +C<P3$Q,J>r-r5Hh!v^PQGXmB<|@+>7wx 6KG');
define('SECURE_AUTH_KEY', 'l|~-`?.Xd;5H8<3#t67DL/|i5-&WR7|0>G({T*ap^u876(U-tJ8w=4RVTd~b`dRQ');
define('LOGGED_IN_KEY', 'l[{_VA=wyfP8R[}B$J|`3I?->9^-cztDP_p)D-@+Hu$wi_k1F@32m_F~fQ})YUi5');
define('NONCE_KEY', '^x9{1a@<*=`{FKDZw,N-h$AW|F]-?-vP+Smc` CM_s)XB-/+q#<71(],%F3f:,h%');
define('AUTH_SALT', '-@J7LN6Z/HUH,:LhpM ^*L0Iumy1c}tz*0((f|z=;2-^1n&uM^jUyK.:KaRi&OhM');
define('SECURE_AUTH_SALT', 's3h-2:Z4bon0^lS%w[^g%wV_XUdn@hH=-{Q.BhG&Z-?:QepN%4gd-O9TW@/>T|R{');
define('LOGGED_IN_SALT', 'F9War`C,scfO-A8&2H>TEck/GuV26eYYu3ID3Fat^5Q[cRu=+y+r2--U)REJ_AAK');
define('NONCE_SALT', 'GO`4t3 8;<=|g|<Op#Wr#-Ph]> {&{mCztL,hW[kT_/EZ|`US)^##c+RT]J+l1qI');
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'ety_';
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
* language support.
*/
define('WPLANG', '');
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', false);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
| gpl-2.0 |
csakis/abmining | accumulation.py | 1513 | #!/usr/bin/python
__author__ = 'Csaba Kiss'
__email__ = 'csakis[at]lanl[dot]gov'
import sys
from blist import blist
"""This file estimates the library size using accumulation using the .cdr3 output of the pipeline"""
if len(sys.argv) < 2:
cdr3_in = raw_input('Please input the file containing all the HCDR3s: ')
else:
cdr3_in = sys.argv[1]
file_in = open(cdr3_in, 'rU') # get the file output by cdr3_cluster
sample_name = cdr3_in.split('.')[0]
file_out = sample_name + '.accumulation' #set the output file name
f_out = open(file_out, 'w')
# the count for the actual CDR3 sample size
# shuffle three times just in case
cdr3_list = blist(file_in.readlines())
ordered_cdr3_list = sorted(cdr3_list, key = lambda str: len(str), reverse= True)
no_of_cdr3 = len(cdr3_list) #the number of CDR3s
cdr3_count = 0
unique_cdr3_no = 0
cdr3_dict = {} # the dictionary of all the CDR3s
unique_cdr3s = {} # the dictionary of unique CDR3 counts
for cdr3 in ordered_cdr3_list:
if cdr3[:-1] in cdr3_dict: #check if the cdr3 is unique
cdr3_dict[cdr3[:-1]] += 1
else:
cdr3_dict[cdr3[:-1]] = 1
unique_cdr3_no += 1
cdr3_count += 1
if cdr3_count % 10000 == 0:
print 'So far %d CDR3s have been checked.' % cdr3_count
unique_cdr3s[cdr3_count] = unique_cdr3_no
for count, unique_no in sorted(unique_cdr3s.items()): #order the CDR3s by abundance
f_out.write('%s, %s\n' % (count, unique_no)) #the csv file contains unique seq, count
f_out.close()
print 'The %s file has been created successfully.' % file_out | gpl-2.0 |
archonwang/redmine_tweaks | assets/javascripts/locales/bootstrap-datepicker.zh.min.js | 591 | !function(a){a.fn.datepicker.dates["zh"]={days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],daysShort:["周日","周一","周二","周三","周四","周五","周六"],daysMin:["日","一","二","三","四","五","六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],today:"今日",clear:"清除",format:"yyyy年mm月dd日",titleFormat:"yyyy年mm月",weekStart:1}}(jQuery);
| gpl-2.0 |
darconeous/sdcc | sim/ucsim/z80.src/z80.cc | 17136 | /*
* Simulator of microcontrollers (z80.cc)
*
* some z80 code base from Karl Bongers karl@turbobit.com
*
* Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
*
* To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
*
*/
/* This file is part of microcontroller simulator: ucsim.
UCSIM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
UCSIM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UCSIM; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/*@1@*/
#include "ddconfig.h"
#include <stdarg.h> /* for va_list */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "i_string.h"
// prj
#include "pobjcl.h"
// sim
#include "simcl.h"
// local
#include "z80cl.h"
#include "glob.h"
#include "regsz80.h"
#define uint32 t_addr
#define uint8 unsigned char
/*******************************************************************/
/*
* Base type of Z80 controllers
*/
cl_z80::cl_z80(class cl_sim *asim):
cl_uc(asim)
{
type= CPU_Z80;
}
int
cl_z80::init(void)
{
cl_uc::init(); /* Memories now exist */
rom= address_space(MEM_ROM_ID);
// ram= mem(MEM_XRAM);
ram= rom;
// zero out ram(this is assumed in regression tests)
for (int i=0x8000; i<0x10000; i++) {
ram->set((t_addr) i, 0);
}
return(0);
}
const char *
cl_z80::id_string(void)
{
return("unspecified Z80");
}
/*
* Making elements of the controller
*/
/*
t_addr
cl_z80::get_mem_size(enum mem_class type)
{
switch(type)
{
case MEM_ROM: return(0x10000);
case MEM_XRAM: return(0x10000);
default: return(0);
}
return(cl_uc::get_mem_size(type));
}
*/
void
cl_z80::mk_hw_elements(void)
{
//class cl_base *o;
/* t_uc::mk_hw() does nothing */
}
void
cl_z80::make_memories(void)
{
class cl_address_space *as;
as= new cl_address_space("rom", 0, 0x10000, 8);
as->init();
address_spaces->add(as);
class cl_address_decoder *ad;
class cl_memory_chip *chip;
chip= new cl_memory_chip("rom_chip", 0x10000, 8);
chip->init();
memchips->add(chip);
ad= new cl_address_decoder(as= address_space("rom"), chip, 0, 0xffff, 0);
ad->init();
as->decoders->add(ad);
ad->activate(0);
}
/*
* Help command interpreter
*/
struct dis_entry *
cl_z80::dis_tbl(void)
{
return(disass_z80);
}
/*struct name_entry *
cl_z80::sfr_tbl(void)
{
return(0);
}*/
/*struct name_entry *
cl_z80::bit_tbl(void)
{
//FIXME
return(0);
}*/
int
cl_z80::inst_length(t_addr addr)
{
int len = 0;
get_disasm_info(addr, &len, NULL, NULL);
return len;
}
int
cl_z80::inst_branch(t_addr addr)
{
int b;
get_disasm_info(addr, NULL, &b, NULL);
return b;
}
int
cl_z80::longest_inst(void)
{
return 4;
}
const char *
cl_z80::get_disasm_info(t_addr addr,
int *ret_len,
int *ret_branch,
int *immed_offset)
{
const char *b = NULL;
uint code;
int len = 0;
int immed_n = 0;
int i;
int start_addr = addr;
struct dis_entry *dis_e;
code= get_mem(MEM_ROM_ID, addr++);
dis_e = NULL;
switch(code) {
case 0xcb: /* ESC code to lots of op-codes, all 2-byte */
code= get_mem(MEM_ROM_ID, addr++);
i= 0;
while ((code & disass_z80_cb[i].mask) != disass_z80_cb[i].code &&
disass_z80_cb[i].mnemonic)
i++;
dis_e = &disass_z80_cb[i];
b= disass_z80_cb[i].mnemonic;
if (b != NULL)
len += (disass_z80_cb[i].length + 1);
break;
case 0xed: /* ESC code to about 80 opcodes of various lengths */
code= get_mem(MEM_ROM_ID, addr++);
i= 0;
while ((code & disass_z80_ed[i].mask) != disass_z80_ed[i].code &&
disass_z80_ed[i].mnemonic)
i++;
dis_e = &disass_z80_ed[i];
b= disass_z80_ed[i].mnemonic;
if (b != NULL)
len += (disass_z80_ed[i].length + 1);
break;
case 0xdd: /* ESC codes,about 284, vary lengths, IX centric */
code= get_mem(MEM_ROM_ID, addr++);
if (code == 0xcb) {
immed_n = 2;
addr++; // pass up immed data
code= get_mem(MEM_ROM_ID, addr++);
i= 0;
while ((code & disass_z80_ddcb[i].mask) != disass_z80_ddcb[i].code &&
disass_z80_ddcb[i].mnemonic)
i++;
dis_e = &disass_z80_ddcb[i];
b= disass_z80_ddcb[i].mnemonic;
if (b != NULL)
len += (disass_z80_ddcb[i].length + 2);
} else {
i= 0;
while ((code & disass_z80_dd[i].mask) != disass_z80_dd[i].code &&
disass_z80_dd[i].mnemonic)
i++;
dis_e = &disass_z80_dd[i];
b= disass_z80_dd[i].mnemonic;
if (b != NULL)
len += (disass_z80_dd[i].length + 1);
}
break;
case 0xfd: /* ESC codes,sme as dd but IY centric */
code= get_mem(MEM_ROM_ID, addr++);
if (code == 0xcb) {
immed_n = 2;
addr++; // pass up immed data
code= get_mem(MEM_ROM_ID, addr++);
i= 0;
while ((code & disass_z80_fdcb[i].mask) != disass_z80_fdcb[i].code &&
disass_z80_fdcb[i].mnemonic)
i++;
dis_e = &disass_z80_fdcb[i];
b= disass_z80_fdcb[i].mnemonic;
if (b != NULL)
len += (disass_z80_fdcb[i].length + 2);
} else {
i= 0;
while ((code & disass_z80_fd[i].mask) != disass_z80_fd[i].code &&
disass_z80_fd[i].mnemonic)
i++;
dis_e = &disass_z80_fd[i];
b= disass_z80_fd[i].mnemonic;
if (b != NULL)
len += (disass_z80_fd[i].length + 1);
}
break;
default:
i= 0;
while ((code & disass_z80[i].mask) != disass_z80[i].code &&
disass_z80[i].mnemonic)
i++;
dis_e = &disass_z80[i];
b= disass_z80[i].mnemonic;
if (b != NULL)
len += (disass_z80[i].length);
break;
}
if (ret_branch) {
*ret_branch = dis_e->branch;
}
if (immed_offset) {
if (immed_n > 0)
*immed_offset = immed_n;
else *immed_offset = (addr - start_addr);
}
if (len == 0)
len = 1;
if (ret_len)
*ret_len = len;
return b;
}
const char *
cl_z80::disass(t_addr addr, const char *sep)
{
char work[256], temp[20];
const char *b;
char *buf, *p, *t;
int len = 0;
int immed_offset = 0;
p= work;
b = get_disasm_info(addr, &len, NULL, &immed_offset);
if (b == NULL) {
buf= (char*)malloc(30);
strcpy(buf, "UNKNOWN/INVALID");
return(buf);
}
while (*b)
{
if (*b == '%')
{
b++;
switch (*(b++))
{
case 'd': // d jump relative target, signed? byte immediate operand
sprintf(temp, "#%d", (char)get_mem(MEM_ROM_ID, addr+immed_offset));
++immed_offset;
break;
case 'w': // w word immediate operand
sprintf(temp, "#0x%04x",
(uint)((get_mem(MEM_ROM_ID, addr+immed_offset)) |
(get_mem(MEM_ROM_ID, addr+immed_offset+1)<<8)) );
++immed_offset;
++immed_offset;
break;
case 'b': // b byte immediate operand
sprintf(temp, "#0x%02x", (uint)get_mem(MEM_ROM_ID, addr+immed_offset));
++immed_offset;
break;
default:
strcpy(temp, "?");
break;
}
t= temp;
while (*t)
*(p++)= *(t++);
}
else
*(p++)= *(b++);
}
*p= '\0';
p= strchr(work, ' ');
if (!p)
{
buf= strdup(work);
return(buf);
}
if (sep == NULL)
buf= (char *)malloc(6+strlen(p)+1);
else
buf= (char *)malloc((p-work)+strlen(sep)+strlen(p)+1);
for (p= work, t= buf; *p != ' '; p++, t++)
*t= *p;
p++;
*t= '\0';
if (sep == NULL)
{
while (strlen(buf) < 6)
strcat(buf, " ");
}
else
strcat(buf, sep);
strcat(buf, p);
return(buf);
}
void
cl_z80::print_regs(class cl_console_base *con)
{
con->dd_printf("SZ-A-PNC Flags= 0x%02x %3d %c ",
regs.F, regs.F, isprint(regs.F)?regs.F:'.');
con->dd_printf("A= 0x%02x %3d %c\n",
regs.A, regs.A, isprint(regs.A)?regs.A:'.');
con->dd_printf("%c%c-%c-%c%c%c\n",
(regs.F&BIT_S)?'1':'0',
(regs.F&BIT_Z)?'1':'0',
(regs.F&BIT_A)?'1':'0',
(regs.F&BIT_P)?'1':'0',
(regs.F&BIT_N)?'1':'0',
(regs.F&BIT_C)?'1':'0');
con->dd_printf("BC= 0x%04x [BC]= %02x %3d %c ",
regs.BC, ram->get(regs.BC), ram->get(regs.BC),
isprint(ram->get(regs.BC))?ram->get(regs.BC):'.');
con->dd_printf("DE= 0x%04x [DE]= %02x %3d %c ",
regs.DE, ram->get(regs.DE), ram->get(regs.DE),
isprint(ram->get(regs.DE))?ram->get(regs.DE):'.');
con->dd_printf("HL= 0x%04x [HL]= %02x %3d %c\n",
regs.HL, ram->get(regs.HL), ram->get(regs.HL),
isprint(ram->get(regs.HL))?ram->get(regs.HL):'.');
con->dd_printf("IX= 0x%04x [IX]= %02x %3d %c ",
regs.IX, ram->get(regs.IX), ram->get(regs.IX),
isprint(ram->get(regs.IX))?ram->get(regs.IX):'.');
con->dd_printf("IY= 0x%04x [IY]= %02x %3d %c ",
regs.IY, ram->get(regs.IY), ram->get(regs.IY),
isprint(ram->get(regs.IY))?ram->get(regs.IY):'.');
con->dd_printf("SP= 0x%04x [SP]= %02x %3d %c\n",
regs.SP, ram->get(regs.SP), ram->get(regs.SP),
isprint(ram->get(regs.SP))?ram->get(regs.SP):'.');
print_disass(PC, con);
}
/*
* Execution
*/
int
cl_z80::exec_inst(void)
{
t_mem code;
if (fetch(&code))
return(resBREAKPOINT);
tick(1);
switch (code)
{
case 0x00: return(inst_nop(code));
case 0x01: case 0x02: case 0x06: return(inst_ld(code));
case 0x03: case 0x04: return(inst_inc(code));
case 0x05: return(inst_dec(code));
case 0x07: return(inst_rlca(code));
case 0x08: return(inst_ex(code));
case 0x09: return(inst_add(code));
case 0x0a: case 0x0e: return(inst_ld(code));
case 0x0b: case 0x0d: return(inst_dec(code));
case 0x0c: return(inst_inc(code));
case 0x0f: return(inst_rrca(code));
case 0x10: return(inst_djnz(code));
case 0x11: case 0x12: case 0x16: return(inst_ld(code));
case 0x13: case 0x14: return(inst_inc(code));
case 0x15: return(inst_dec(code));
case 0x17: return(inst_rla(code));
case 0x18: return(inst_jr(code));
case 0x19: return(inst_add(code));
case 0x1a: case 0x1e: return(inst_ld(code));
case 0x1b: case 0x1d: return(inst_dec(code));
case 0x1c: return(inst_inc(code));
case 0x1f: return(inst_rra(code));
case 0x20: return(inst_jr(code));
case 0x21: case 0x22: case 0x26: return(inst_ld(code));
case 0x23: case 0x24: return(inst_inc(code));
case 0x25: return(inst_dec(code));
case 0x27: return(inst_daa(code));
case 0x28: return(inst_jr(code));
case 0x29: return(inst_add(code));
case 0x2a: case 0x2e: return(inst_ld(code));
case 0x2b: case 0x2d: return(inst_dec(code));
case 0x2c: return(inst_inc(code));
case 0x2f: return(inst_cpl(code));
case 0x30: return(inst_jr(code));
case 0x31: case 0x32: case 0x36: return(inst_ld(code));
case 0x33: case 0x34: return(inst_inc(code));
case 0x35: return(inst_dec(code));
case 0x37: return(inst_scf(code));
case 0x38: return(inst_jr(code));
case 0x39: return(inst_add(code));
case 0x3a: case 0x3e: return(inst_ld(code));
case 0x3b: case 0x3d: return(inst_dec(code));
case 0x3c: return(inst_inc(code));
case 0x3f: return(inst_ccf(code));
case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47:
case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
return(inst_ld(code));
case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57:
case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f:
return(inst_ld(code));
case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67:
case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
return(inst_ld(code));
case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x77:
case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f:
return(inst_ld(code));
case 0x76:
return(inst_halt(code));
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
return(inst_add(code));
case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f:
return(inst_adc(code));
case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97:
return(inst_sub(code));
case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f:
return(inst_sbc(code));
case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
return(inst_and(code));
case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:
return(inst_xor(code));
case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7:
return(inst_or(code));
case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf:
return(inst_cp(code));
case 0xc0: return(inst_ret(code));
case 0xc1: return(inst_pop(code));
case 0xc2: case 0xc3: return(inst_jp(code));
case 0xc4: return(inst_call(code));
case 0xc5: return(inst_push(code));
case 0xc6: return(inst_add(code));
case 0xc7: return(inst_rst(code));
case 0xc8: case 0xc9: return(inst_ret(code));
case 0xca: return(inst_jp(code));
/* CB escapes out to 2 byte opcodes(CB include), opcodes
to do register bit manipulations */
case 0xcb: return(inst_cb());
case 0xcc: case 0xcd: return(inst_call(code));
case 0xce: return(inst_adc(code));
case 0xcf: return(inst_rst(code));
case 0xd0: return(inst_ret(code));
case 0xd1: return(inst_pop(code));
case 0xd2: return(inst_jp(code));
case 0xd3: return(inst_out(code));
case 0xd4: return(inst_call(code));
case 0xd5: return(inst_push(code));
case 0xd6: return(inst_sub(code));
case 0xd7: return(inst_rst(code));
case 0xd8: return(inst_ret(code));
case 0xd9: return(inst_exx(code));
case 0xda: return(inst_jp(code));
case 0xdb: return(inst_in(code));
case 0xdc: return(inst_call(code));
/* DD escapes out to 2 to 4 byte opcodes(DD included)
with a variety of uses. It can precede the CB escape
sequence to extend CB codes with IX+immed_byte */
case 0xdd: return(inst_dd());
case 0xde: return(inst_sbc(code));
case 0xdf: return(inst_rst(code));
case 0xe0: return(inst_ret(code));
case 0xe1: return(inst_pop(code));
case 0xe2: return(inst_jp(code));
case 0xe3: return(inst_ex(code));
case 0xe4: return(inst_call(code));
case 0xe5: return(inst_push(code));
case 0xe6: return(inst_and(code));
case 0xe7: return(inst_rst(code));
case 0xe8: return(inst_ret(code));
case 0xe9: return(inst_jp(code));
case 0xea: return(inst_jp(code));
case 0xeb: return(inst_ex(code));
case 0xec: return(inst_call(code));
/* ED escapes out to misc IN, OUT and other oddball opcodes */
case 0xed: return(inst_ed());
case 0xee: return(inst_xor(code));
case 0xef: return(inst_rst(code));
case 0xf0: return(inst_ret(code));
case 0xf1: return(inst_pop(code));
case 0xf2: return(inst_jp(code));
case 0xf3: return(inst_di(code));
case 0xf4: return(inst_call(code));
case 0xf5: return(inst_push(code));
case 0xf6: return(inst_or(code));
case 0xf7: return(inst_rst(code));
case 0xf8: return(inst_ret(code));
case 0xf9: return(inst_ld(code));
case 0xfa: return(inst_jp(code));
case 0xfb: return(inst_ei(code));
case 0xfc: return(inst_call(code));
/* DD escapes out to 2 to 4 byte opcodes(DD included)
with a variety of uses. It can precede the CB escape
sequence to extend CB codes with IX+immed_byte */
case 0xfd: return(inst_fd());
case 0xfe: return(inst_cp(code));
case 0xff: return(inst_rst(code));
}
/*if (PC)
PC--;
else
PC= get_mem_size(MEM_ROM_ID)-1;*/
PC= rom->inc_address(PC, -1);
sim->stop(resINV_INST);
return(resINV_INST);
}
/* End of z80.src/z80.cc */
| gpl-2.0 |
andrewbasterfield/mysqlcc | translations/Deutsch.ts | 140221 | <!DOCTYPE TS><TS>
<context>
<name>CAboutBox</name>
<message>
<source>About</source>
<translation>Über</translation>
</message>
<message>
<source>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CAdministrationWindow</name>
<message>
<source>Administration Panel</source>
<translation>Administrationsfeld</translation>
</message>
<message>
<source>Process List</source>
<translation>Prozessliste</translation>
</message>
<message>
<source>Status</source>
<translation>Status</translation>
</message>
<message>
<source>Variables</source>
<translation>Variablen</translation>
</message>
<message>
<source>&Process List</source>
<translation>&Prozessliste</translation>
</message>
<message>
<source>&Status</source>
<translation>&Status</translation>
</message>
<message>
<source>&Variables</source>
<translation>&Variablen</translation>
</message>
<message>
<source>&InnoDB Status</source>
<translation>&InnoDB Status</translation>
</message>
<message>
<source>InnoDB Status</source>
<translation>InnoDB Status</translation>
</message>
<message>
<source>Show Messages</source>
<translation>Zeige Nachrichten</translation>
</message>
<message>
<source>Show &Messages</source>
<translation>Zeige &Nachrichten</translation>
</message>
<message>
<source>View</source>
<translation>Ansicht</translation>
</message>
<message>
<source>Close</source>
<translation>Schließen</translation>
</message>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
<message>
<source>File</source>
<translation>Datei</translation>
</message>
<message>
<source>Refresh</source>
<translation>Aktualisieren</translation>
</message>
<message>
<source>&Refresh</source>
<translation>&Aktualisieren</translation>
</message>
<message>
<source>Kill Process</source>
<translation>Prozess beenden</translation>
</message>
<message>
<source>&Kill Process</source>
<translation>&Prozess beenden</translation>
</message>
<message>
<source>Action</source>
<translation>Aktion</translation>
</message>
<message>
<source>Ping</source>
<translation>Ping</translation>
</message>
<message>
<source>&Ping</source>
<translation>&Ping</translation>
</message>
<message>
<source>Shutdown</source>
<translation>Beenden</translation>
</message>
<message>
<source>&Shutdown</source>
<translation>&Beenden</translation>
</message>
<message>
<source>Start Refresh Timer</source>
<translation>Aktualisierungstimer starten</translation>
</message>
<message>
<source>Start Refresh &Timer</source>
<translation>Aktualisierungs&timer starten</translation>
</message>
<message>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<source>&File</source>
<translation>&Datei</translation>
</message>
<message>
<source>&View</source>
<translation>&Ansicht</translation>
</message>
<message>
<source>Flush</source>
<translation>Bereinigen</translation>
</message>
<message>
<source>&Action</source>
<translation>&Aktion</translation>
</message>
<message>
<source>Action Bar</source>
<translation>Aktionsbalken</translation>
</message>
<message>
<source>Refresh Bar</source>
<translation>Aktualisierungsbalken</translation>
</message>
<message>
<source>Refresh Rate (sec)</source>
<translation>Aktualisierungsrate (sek)</translation>
</message>
<message>
<source>Process killed successfully</source>
<translation>Prozess erfolgreich beendet</translation>
</message>
<message>
<source>Stop Refresh &Timer</source>
<translation>Aktualisierungs&timer anhalten</translation>
</message>
<message>
<source>&Hosts</source>
<translation>&Rechner</translation>
</message>
<message>
<source>&Logs</source>
<translation>&Logs</translation>
</message>
<message>
<source>&Privileges</source>
<translation>&Privilegien</translation>
</message>
<message>
<source>&Tables</source>
<translation>&Tabellen</translation>
</message>
<message>
<source>Tables with &Read Lock</source>
<translation>Tabellen mit &Read Lock</translation>
</message>
<message>
<source>&DES Keys</source>
<translation>&DES Schlüssel</translation>
</message>
<message>
<source>&Query Cache</source>
<translation>&Abfrage Cache</translation>
</message>
<message>
<source>&User Resources</source>
<translation>Ben&utzerressourcen</translation>
</message>
<message>
<source>mysqld is alive</source>
<translation>mysqld läuft</translation>
</message>
<message>
<source>Confirm Shutdown</source>
<translation>Beenden bestätigen</translation>
</message>
<message>
<source>Are you sure you want to Shutdown mysqld ?</source>
<translation>Sind Sie sicher, dass Sie mysqld beenden
wollen?</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
<source>mysqld was shutdown successfully</source>
<translation>mysqld wurde erfolgreich beendet</translation>
</message>
<message>
<source>successful</source>
<translation>erfolgreich</translation>
</message>
<message>
<source>Refresh successful</source>
<translation>Aktualisierung erfolgreich</translation>
</message>
</context>
<context>
<name>CAdministrationWindow::CShowServerVariables</name>
<message>
<source>Property</source>
<translation>Eigenschaft</translation>
</message>
<message>
<source>Value</source>
<translation>Wert</translation>
</message>
<message>
<source>Server Variables</source>
<translation>Servervariablen</translation>
</message>
</context>
<context>
<name>CAlterTableOptions</name>
<message>
<source>Alter Table Options</source>
<translation>Alter Table Optionen</translation>
</message>
<message>
<source>Order By</source>
<translation>Sortieren nach</translation>
</message>
<message>
<source>IGNORE</source>
<translation>IGNORIEREN</translation>
</message>
</context>
<context>
<name>CAppConfigDialog</name>
<message>
<source>General Configuration Dialog</source>
<translation>Dialog Allgemeine Konfiguration</translation>
</message>
<message>
<source>&Apply</source>
<translation>&Übernehmen</translation>
</message>
<message>
<source>Click to Apply changes.</source>
<translation>Klicken um Änderungen zu übernehmen.</translation>
</message>
<message>
<source>Error</source>
<translation>Fehler</translation>
</message>
<message>
<source>An Error occurred while saving the Configuration.</source>
<translation>Beim Speichern der Konfiguration ist ein Fehler
aufgetreten.</translation>
</message>
<message>
<source>Restart</source>
<translation>Neu starten</translation>
</message>
<message>
<source>You will need to restart mysqlcc before you notice your changes.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CApplication</name>
<message>
<source>Plugin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>successfully loaded</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>failed to load</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CConfigDialog</name>
<message>
<source>This is the Configuration Dialog.</source>
<translation>Dies ist der Konfigurationsdialog</translation>
</message>
<message>
<source>&Ok</source>
<translation>&OK</translation>
</message>
<message>
<source>&Cancel</source>
<translation>&Abbrechen</translation>
</message>
<message>
<source>Close this Dialog without saving any changes you have made.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CConsoleWindow</name>
<message>
<source>Console Manager</source>
<translation>Consolenmanager</translation>
</message>
<message>
<source>Confirm Exit</source>
<translation>Beenden bestätigen</translation>
</message>
<message>
<source>Are you sure you want to Exit ?</source>
<translation>Wollen Sie wirklich beenden?</translation>
</message>
<message>
<source>Message Panel</source>
<translation>Nachrichtenfeld</translation>
</message>
<message>
<source>MySQL Servers</source>
<translation>MySQL Server</translation>
</message>
<message>
<source>Tree Panel</source>
<translation>Baumfeld</translation>
</message>
<message>
<source>&File</source>
<translation>&Datei</translation>
</message>
<message>
<source>Console</source>
<translation>Konsole</translation>
</message>
<message>
<source>SQL Debug</source>
<translation>SQL Debuggen</translation>
</message>
<message>
<source>New</source>
<translation>Neu</translation>
</message>
<message>
<source>&New</source>
<translation>&Neu</translation>
</message>
<message>
<source>File</source>
<translation>Datei</translation>
</message>
<message>
<source>Refresh</source>
<translation>Aktualisieren</translation>
</message>
<message>
<source>&Refresh</source>
<translation>&Aktualisieren</translation>
</message>
<message>
<source>Action</source>
<translation>Aktion</translation>
</message>
<message>
<source>Query</source>
<translation>Abfrage</translation>
</message>
<message>
<source>&Query</source>
<translation>&Abfrage</translation>
</message>
<message>
<source>Show Tree</source>
<translation>Baum anzeigen</translation>
</message>
<message>
<source>&Show Tree</source>
<translation>&Baum anzeigen</translation>
</message>
<message>
<source>View</source>
<translation>Ansicht</translation>
</message>
<message>
<source>Show Messages</source>
<translation>Nachrichten anzeigen</translation>
</message>
<message>
<source>Show &Messages</source>
<translation>&Nachrichten anzeigen</translation>
</message>
<message>
<source>&View</source>
<translation>&Ansicht</translation>
</message>
<message>
<source>Exit</source>
<translation>Beenden</translation>
</message>
<message>
<source>E&xit</source>
<translation>&Beenden</translation>
</message>
<message>
<source>&Action</source>
<translation>&Aktion</translation>
</message>
<message>
<source>Close</source>
<translation>Schließen</translation>
</message>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
</context>
<context>
<name>CCreditsBox</name>
<message>
<source>Credits</source>
<translation>Dank</translation>
</message>
</context>
<context>
<name>CCreditsWidget</name>
<message>
<source>Special Thanks To:</source>
<translation>Besonderen Dank an:</translation>
</message>
<message>
<source>Contributors:</source>
<translation>Mitwirkende:</translation>
</message>
<message>
<source> Volker Hilsheimer<br>
Trolltech Support Team<br>
Tarmo Järvalt<br>
Lenz Grimmer<br>
Alexander Keremidarski<br>
Matt Wagner<br>
Jeremy Cole<br>
Tom Basil<br>
And many others<br></source>
<translation></translation>
</message>
<message>
<source>People who contributed indirectly to this development.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>People who contributed directly to this development.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> <b>Jorge del Conde</b> [jorge@mysql.com]<br>
<b>Sasha Pachev</b> [sasha@mysql.com]<br>
<b>Michael Widenius</b> [monty@mysql.com]<br>
<b>Rafal Kurczyna</b> [rafal@kurczyna.com]<br>
<b>Reginald Stadlbauer</b> [reggie@trolltech.com]<br>
<b>Alexander M. Stetsenko</b> [ams@yandex.ru]<br>
<b>Adam Hooper</b> [adamh@densi.com]<br>
<b>Peter O'Gorman</b> [peter@pogma.com]<br>
<b>Alexander Ustimenko</b> [ustimenko@nsaem.ru]<br>
<b>Deng Jie</b> [deng@dengjie.com]<br>
<b>Mat Leinmueller</b> [m_leinmuller@hotmail.com]<br>
<b>Philippe Boxho</b> [boxhoph@ibelgique.com]<br>
<b>Andrea Decorte</b> [klenje@adriacom.it]<br>
<b>Radoslaw Zawartko</b> [radzaw@lnet.szn.pl]</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CDatabaseGroupItem</name>
<message>
<source>Databases</source>
<translation>Datenbanken</translation>
</message>
<message>
<source>Create Database</source>
<translation>Datenbank erzeugen</translation>
</message>
<message>
<source>Enter new Database name</source>
<translation>Neuen Datenbanknamen eingeben</translation>
</message>
<message>
<source>&New Database</source>
<translation>&Neue Datenbank</translation>
</message>
<message>
<source>&Refresh</source>
<translation>&Aktualisieren</translation>
</message>
<message>
<source>New &Window from Here</source>
<translation>Neues &Fenster ab hier</translation>
</message>
<message>
<source>Querying MySQL Server for Database Information.</source>
<translation>Anfragen des MySQL Servers für
Datenbankinformationen.</translation>
</message>
</context>
<context>
<name>CDatabaseItem</name>
<message>
<source>Confirm Delete Database</source>
<translation>Datenbank löschen bestätigen</translation>
</message>
<message>
<source>Are you sure you want to Delete Database</source>
<translation>Sind Sie sicher, dass Sie diese Datenbank löschen
wollen?</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
<source>&Connect</source>
<translation>&Verbinden</translation>
</message>
<message>
<source>&Disconnect</source>
<translation>&Trennen</translation>
</message>
<message>
<source>D&rop Database</source>
<translation>Datenbank &löschen</translation>
</message>
<message>
<source>New &Window from Here</source>
<translation>Neues &Fenster ab hier</translation>
</message>
</context>
<context>
<name>CDatabaseListView</name>
<message>
<source>MySQL Servers</source>
<translation>MySQL Server</translation>
</message>
<message>
<source>New</source>
<translation>Neu</translation>
</message>
<message>
<source>Refresh</source>
<translation>Aktualisieren</translation>
</message>
<message>
<source>Hide</source>
<translation>Verbergen</translation>
</message>
</context>
<context>
<name>CDatabaseServerOptionsTab</name>
<message>
<source>Databases</source>
<translation>Datenbanken</translation>
</message>
<message>
<source>Show all Databases</source>
<translation>Alle Datenbanken zeigen</translation>
</message>
<message>
<source>Database Retrieval Method</source>
<translation>Datenbank Abfragemethode</translation>
</message>
<message>
<source>Add new Database</source>
<translation>Neue Datenbank hinzufügen</translation>
</message>
<message>
<source>Delete selected Database</source>
<translation>Ausgewählte Datenbank löschen</translation>
</message>
<message>
<source>Use the following Databases:</source>
<translation>Die folgenden Datenbanken benutzen:</translation>
</message>
<message>
<source>Only the following Databases will be displayed</source>
<translation>Nur die folgenden Datenbanken werden
angezeigt</translation>
</message>
<message>
<source>Use SHOW DATABASES</source>
<translation>SHOW DATABASES verwenden</translation>
</message>
<message>
<source>Databases that will be shown in the Database Tree</source>
<translation>Datenbanken, die im Datenbankbaum angezeigt
werden</translation>
</message>
<message>
<source>Database</source>
<translation>Datenbank</translation>
</message>
<message>
<source>Please enter the Database Name</source>
<translation>Bitte geben Sie den Datenbanknamen ein</translation>
</message>
<message>
<source>Warning</source>
<translation>Warnung</translation>
</message>
<message>
<source>The database is already in the list.</source>
<translation>Die Datenbank ist bereits in der Liste.</translation>
</message>
<message>
<source>When enabled, all the databases in the server will be displayed. If unchecked, only the databases to which you have access to will be shown.\n\nNOTE: This option calls mysql_select_db() for each database to check access. If unchecked, it will take longer to connect to a server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The SHOW DATABASES command will be used to retrieve all the Databases in the server.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CExplainQueryPanel</name>
<message>
<source>Explain Panel</source>
<translation>Erklärungsfeld</translation>
</message>
<message>
<source>&Copy</source>
<translation>&Kopieren</translation>
</message>
</context>
<context>
<name>CFieldEditorWindow</name>
<message>
<source>&Apply</source>
<translation>Ü&bernehmen</translation>
</message>
<message>
<source>&Cancel</source>
<translation>&Abbrechen</translation>
</message>
<message>
<source>Field Editor</source>
<translation>Feldeditor</translation>
</message>
</context>
<context>
<name>CFieldProperties</name>
<message>
<source>Field Properties</source>
<translation>Feldeigenschaften</translation>
</message>
<message>
<source>Default</source>
<translation>Standard</translation>
</message>
<message>
<source>Length</source>
<translation>Länge</translation>
</message>
<message>
<source>Value</source>
<translation>Wert</translation>
</message>
<message>
<source>Default value for the Field.</source>
<translation>Standardwert für dieses Feld</translation>
</message>
<message>
<source>UNSIGNED</source>
<translation></translation>
</message>
<message>
<source>BINARY</source>
<translation></translation>
</message>
<message>
<source>ZEROFILL</source>
<translation></translation>
</message>
<message>
<source>AUTO_INCREMENT</source>
<translation></translation>
</message>
<message>
<source>This stores the values for SET & ENUM Fields. Separate each field with commas and when using text values, enclose them with single-quotes.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Maximum Length of the Field. When empty, the Default Length will be used.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set the UNSIGNED property for this field. For more information refere to the MySQL manual.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set the BINARY property for this field. For more information refere to the MySQL manual.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set the ZEROFILL property for this field. For more information refere to the MySQL manual.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Set the AUTO_INCREMENT property for this field. For more information refere to the MySQL manual.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CGeneralAppConfigTab</name>
<message>
<source>General</source>
<translation>Allgemein</translation>
</message>
<message>
<source>Restore last Workspace on startup</source>
<translation>Letzte Arbeitsumgebung beim Start
wiederherstellen</translation>
</message>
<message>
<source>History size for Queries</source>
<translation>Größe der Historie für Abfragen</translation>
</message>
<message>
<source>Max query size</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Language</source>
<translation>Sprache</translation>
</message>
<message>
<source>Information Sound File</source>
<translation>Klangdatei Information</translation>
</message>
<message>
<source>Warning Sound File</source>
<translation>Klangdatei Warnung</translation>
</message>
<message>
<source>Error Sound File</source>
<translation>Klangdatei Fehler</translation>
</message>
<message>
<source>Translations Path</source>
<translation>Pfad für Übersetzungen</translation>
</message>
<message>
<source>Select the Translations Path</source>
<translation>Pfad für Übersetzungen wählen</translation>
</message>
<message>
<source>Wav Files(*.wav)</source>
<translation>Wav Dateien(*.wav)</translation>
</message>
<message>
<source>Select Error Sound</source>
<translation>Fehlerklang wählen</translation>
</message>
<message>
<source>Select Warning Sound</source>
<translation>Warnungsklang wählen</translation>
</message>
<message>
<source>Select Information Sound</source>
<translation>Informationsklang wählen</translation>
</message>
<message>
<source>Confirm critical operations</source>
<translation>Kritische Operationen bestätigen</translation>
</message>
<message>
<source>This is a WAV file that will be played each time an Error message occures. If you don't want to play a sound, leave this field empty.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the Path which will be used by the application to find Language Files.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click to browse for the Warning WAV File.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click to browse for the Information WAV File.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click to browse for the Error WAV File.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click to browse for a the Translations Path</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is a WAV file that will be played each time a Information message occures. If you don't want to play a sound, leave this field empty.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is a WAV file that will be played each time a Warning message occures. If you don't want to play a sound, leave this field empty.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When enabled, the application will restore the last Workspace of the previous execution by automatically opening all windows and connections which where open prior shutdown.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will change the display Language of the Application. If changed, one will have to restart the application for changes to take place.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This number specifies how many Queries will be saved by the History Panel in the Query Windows.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This number specifies the maximum size of a Query that will be saved by the History Panel in the Query Windows.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This option will confirm critical operations done by the client. Such critical operations include shutting down the application, shutting down the Server, truncate table, etc ...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CGeneralServerOptionsTab</name>
<message>
<source>General</source>
<translation>Allgemein</translation>
</message>
<message>
<source>Name</source>
<translation>Name</translation>
</message>
<message>
<source>Port</source>
<translation>Port</translation>
</message>
<message>
<source>Password</source>
<translation>Passwort</translation>
</message>
<message>
<source>User Name</source>
<translation>Benutzername</translation>
</message>
<message>
<source>Host Name</source>
<translation>Rechnername</translation>
</message>
<message>
<source>Table retrieval method</source>
<translation>Methode zur Abfrage der Tabelle</translation>
</message>
<message>
<source>SHOW TABLE STATUS</source>
<translation>SHOW TABLE STATUS</translation>
</message>
<message>
<source>SHOW TABLES</source>
<translation>SHOW TABLES</translation>
</message>
<message>
<source>Options</source>
<translation>Optionen</translation>
</message>
<message>
<source>Blocking Queries</source>
<translation>Blockierende Abfragen</translation>
</message>
<message>
<source>Socket File</source>
<translation>Socket Datei</translation>
</message>
<message>
<source>Click to browse for a Socket File</source>
<translation>Hier klicken um eine Socketdatei zu
suchen</translation>
</message>
<message>
<source>Use a single connection</source>
<translation>Eine einzelne Verbindung verwenden</translation>
</message>
<message>
<source>Enable SSL</source>
<translation>SSL aktivieren</translation>
</message>
<message>
<source>Enable SSL between client & server.</source>
<translation>SSL zwischen Client und Server
aktivieren.</translation>
</message>
<message>
<source>Use Compression</source>
<translation>Kompression verwenden</translation>
</message>
<message>
<source>Use the compressed client/server protocol.</source>
<translation>Das komprimierte Client/Server Protokoll
verwenden.</translation>
</message>
<message>
<source>Prompt for Password</source>
<translation>Passwort abfragen</translation>
</message>
<message>
<source>The following fields contain invalid characters</source>
<translation>Die folgenden Felder enthalten ungültige
Zeichen</translation>
</message>
<message>
<source>All Files (*)</source>
<translation>Alle Dateien (*)</translation>
</message>
<message>
<source>Select the MySQL Socket file</source>
<translation>MySQL Socketdatei wählen</translation>
</message>
<message>
<source>Completion and Syntax Highlighting</source>
<translation>Abschluß- und Syntaxhervorhebung</translation>
</message>
<message>
<source>Make this server the Default Connection</source>
<translation>Diesen Server als Standardverbindung
festlegen</translation>
</message>
<message>
<source>Specifies the Database Server you'll be connecting to. A valid Host Name or IP address is required to establish a connection.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This method will make the GUI better looking but it will be slower than SHOW TABLES. This option is recommended if the server you'll be connecting to doesn't have databases with many tables (<= 300).</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This method is recommended when you're connecting to a server where the databases have many tables (> 300). It's less appealing in terms of visual effects as opposed to SHOW TABLE STATUS, but it will retrieve tables much faster. This method will be used automatically when connecting to MySQL Servers < 3.23.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Specifies the Password associated with the User Name which will be used to connect to the Server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Specifies the User Name which will be used to connect to the Server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TCP/IP Port Number to which the Server is listening to.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is an alias to your connection. Whatever you type here it will be displayed in the Left Tree.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use a Unix Socket File instead of a TCP/IP connection to the Server. This option will override the Host Name and Port.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable this option if you only want to use One connection rather than having MySQL Control Center use as many as required. This option is recommended for when connecting to a high-load server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use Blocking Queries when enabled. This option will allow the user to keep doing things while processing a query. If disabled, the application will block until the query is concluded. If you're unsure about this option, leave it disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable Completion and Syntax Highlighting for the Database, Tables and Fields in this connection.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When enabled, a Password Dialog will appear before a connection to the Server is attempted. This is useful for when you don't want to store your password in the settings file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When checked, this server will be used as the default server for command line parameters.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Never automatically connect to this server on startup</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When checked, MySQLCC will not automatically connect to this server on startup.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CHelpMenu</name>
<message>
<source>Contents</source>
<translation>Inhalt</translation>
</message>
<message>
<source>&Contents</source>
<translation>&Inhalt</translation>
</message>
<message>
<source>About</source>
<translation>Über</translation>
</message>
<message>
<source>&About</source>
<translation>Ü&ber</translation>
</message>
<message>
<source>&Help</source>
<translation>&Hilfe</translation>
</message>
<message>
<source>What's This ?</source>
<translation>Was ist das?</translation>
</message>
<message>
<source>&What's This ?</source>
<translation>&Was ist das?</translation>
</message>
<message>
<source>Credits</source>
<translation>Dank</translation>
</message>
<message>
<source>&Credits</source>
<translation>&Dank</translation>
</message>
<message>
<source>Help</source>
<translation>Hilfe</translation>
</message>
</context>
<context>
<name>CHistoryPanel</name>
<message>
<source>Messages</source>
<translation>Nachrichten</translation>
</message>
<message>
<source>Execute Query</source>
<translation>Abfrage ausführen</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<source>Refresh</source>
<translation>Aktualisieren</translation>
</message>
<message>
<source>Explain Query</source>
<translation>Anfrage erklären</translation>
</message>
</context>
<context>
<name>CHistoryView</name>
<message>
<source>Error</source>
<translation>Fehler</translation>
</message>
<message>
<source>An error occurred while saving the history list.</source>
<translation>Beim Speichern der Historienliste ist ein Fehler
aufgetreten.</translation>
</message>
</context>
<context>
<name>CHotKeyEditorDialog</name>
<message>
<source>HotKey Configuration Dialog</source>
<translation>HotKey Konfigurationsdialog</translation>
</message>
<message>
<source>&Apply</source>
<translation>&Anwenden</translation>
</message>
<message>
<source>Click to Apply changes.</source>
<translation>Hier klicken um Änderungen zu
übernehmen.</translation>
</message>
<message>
<source>&Map Keys</source>
<translation>&Tasten zuweisen</translation>
</message>
<message>
<source>Click here to map the keys for the selected Action..</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CHotKeyEditorMenu</name>
<message>
<source>HotKey Editor</source>
<translation>HotKey Editor</translation>
</message>
<message>
<source>Hot&Key Editor</source>
<translation>Hot&Key Editor</translation>
</message>
<message>
<source>Hot&Keys</source>
<translation>Hot&Keys</translation>
</message>
</context>
<context>
<name>CHotKeyEditorTab</name>
<message>
<source>HotKey Editor</source>
<translation>HotKey Editor</translation>
</message>
<message>
<source>Action</source>
<translation>Aktion</translation>
</message>
<message>
<source>HotKey</source>
<translation>HotKey</translation>
</message>
<message>
<source>HotKey Setup</source>
<translation>HotKey Setup</translation>
</message>
<message>
<source>Action is the column that contains items that can have a hot-key defined.
HotKey is the column that displays the hot-key combination for the specified Action.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Press the key-combination you want as a HotKey for the selected Action.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CImageViewer</name>
<message>
<source>Image Viewer</source>
<translation>Bildbetrachter</translation>
</message>
<message>
<source>Column</source>
<translation>Zeile</translation>
</message>
<message>
<source>Open</source>
<translation>Öffnen</translation>
</message>
<message>
<source>&Open</source>
<translation>Ö&ffnen</translation>
</message>
<message>
<source>File</source>
<translation>Datei</translation>
</message>
<message>
<source>Scale Contents</source>
<translation>Inhalt skalieren</translation>
</message>
<message>
<source>Sc&ale Contents</source>
<translation>&Inhalt skalieren</translation>
</message>
<message>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>&Copy</source>
<translation>&Kopieren</translation>
</message>
<message>
<source>Close</source>
<translation>Schließen</translation>
</message>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
<message>
<source>Tools</source>
<translation>Werkzeuge</translation>
</message>
<message>
<source>Save &As</source>
<translation>Speichern &unter</translation>
</message>
<message>
<source>&File</source>
<translation>&Datei</translation>
</message>
<message>
<source>&Edit</source>
<translation>&Bearbeiten</translation>
</message>
<message>
<source>Replace File</source>
<translation>Datei ersetzen</translation>
</message>
<message>
<source>The specified file name already exists.
Do you want to replace it ?</source>
<translation>Der Dateiname existiert bereits.
Wollen Sie sie ersetzen?</translation>
</message>
<message>
<source>Successfully saved</source>
<translation>Erfolgreich gespeichert</translation>
</message>
<message>
<source>An error occurred while saving the file</source>
<translation>Beim Speichern der Datei ist ein Fehler
aufgetreten</translation>
</message>
<message>
<source>An error occured while trying to load</source>
<translation>Beim Versuch zu laden ist ein Fehler
aufgetreten</translation>
</message>
<message>
<source>An error occurred while loading the image.</source>
<translation>Beim Laden des Bildes ist ein Fehler
aufgetreten.</translation>
</message>
<message>
<source>There is not enough memory to open the file</source>
<translation>Nicht genügend Speicher zum Öffnen der
Datei</translation>
</message>
</context>
<context>
<name>CInfoDialog</name>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
<message>
<source>Click to close this dialog.</source>
<translation>Klicken um diesen Dialog zu schließen.</translation>
</message>
<message>
<source>For more information please visit http://www.mysql.com</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CInnoDBStatus</name>
<message>
<source>Connection</source>
<translation>Verbindung</translation>
</message>
<message>
<source>Host</source>
<translation>Rechner</translation>
</message>
<message>
<source>Saved</source>
<translation>Gespeichert</translation>
</message>
<message>
<source>Text Files (*.txt);;All Files(*.*)</source>
<translation>Textdateien (*.txt);;Alle Dateien(*.*)</translation>
</message>
<message>
<source>&Save</source>
<translation>&Speichern</translation>
</message>
<message>
<source>&Refresh</source>
<translation>&Aktualisieren</translation>
</message>
<message>
<source>&Copy</source>
<translation>&Kopieren</translation>
</message>
</context>
<context>
<name>CMDIWindow</name>
<message>
<source>Exit</source>
<translation>Beenden</translation>
</message>
<message>
<source>E&xit</source>
<translation>&Beenden</translation>
</message>
<message>
<source>&Console</source>
<translation>&Konsole</translation>
</message>
<message>
<source>&Window</source>
<translation>&Fenster</translation>
</message>
<message>
<source>Confirm Exit</source>
<translation>Beenden bestätigen</translation>
</message>
<message>
<source>Are you sure you want to Exit ?</source>
<translation>Sind Sie sicher, dass Sie beenden wollen?</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
<source>Cl&ose</source>
<translation>&Schließen</translation>
</message>
<message>
<source>Close Al&l</source>
<translation>&Alle schließen</translation>
</message>
<message>
<source>&Cascade</source>
<translation>&Untereinander anordnen</translation>
</message>
<message>
<source>&Tile</source>
<translation>&Nebeneinander anordnen</translation>
</message>
</context>
<context>
<name>CMessagePanel</name>
<message>
<source>Messages</source>
<translation>Nachrichten</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<source>Clear</source>
<translation>Zurücksetzen</translation>
</message>
</context>
<context>
<name>CMessageWindow</name>
<message>
<source>Message Panel</source>
<translation>Nachrichtenfeld</translation>
</message>
</context>
<context>
<name>CMySQL</name>
<message>
<source>Unspecified MySQL Error</source>
<translation>Unbekannter MySQL Fehler</translation>
</message>
</context>
<context>
<name>CMySQLOptionsTab</name>
<message>
<source>MySQL Options</source>
<translation>MySQL Optionen</translation>
</message>
<message>
<source>Connect Timeout (sec)</source>
<translation>Verbindungs-Timeout (sek)</translation>
</message>
<message>
<source>Automatically limit SELECT queries to</source>
<translation>SELECT abfragen automatisch begrenzen auf</translation>
</message>
<message>
<source>Net Buffer Length</source>
<translation>Netzpuffergröße</translation>
</message>
<message>
<source>Maximum Allowed Packet</source>
<translation>Maximal erlaubtes Paket</translation>
</message>
<message>
<source>Maximum Join Size</source>
<translation>Maximale Join Größe</translation>
</message>
<message>
<source>Allow the use of LOAD DATA LOCAL INFILE</source>
<translation>Die Verwendung von LOAD DATA LOCAL INFILE
erlauben</translation>
</message>
<message>
<source>Automatic limit rows in a join.</source>
<translation>Automatisch Zeilen in einem Join
begrenzen.</translation>
</message>
<message>
<source>Unlimited</source>
<translation type="unfinished">Unbegrenzt</translation>
</message>
<message>
<source>Specifies the amount of time the client should wait to receive a response from the server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This option will automatically limit the number of results returned by a SELECT query if the LIMIT clause wasn't specified.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Buffer length for TCP/IP and socket communication between the client and the server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Maximum packet-length to send and receive from to server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When enabled, the use of LOAD DATA LOCAL INFILE will be available.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CMySQLQuery</name>
<message>
<source>sec</source>
<translation>sek</translation>
</message>
<message>
<source>Query OK</source>
<translation>Abfrage OK</translation>
</message>
<message>
<source>Query OK,</source>
<translation>Abfrage OK,</translation>
</message>
<message>
<source>row</source>
<translation>Zeile</translation>
</message>
<message>
<source>rows</source>
<translation>Zeilen</translation>
</message>
<message>
<source>affected</source>
<translation>betroffen</translation>
</message>
<message>
<source>Empty set</source>
<translation>Leeres Ergebnis</translation>
</message>
<message>
<source>in set</source>
<translation>im Ergebnis</translation>
</message>
</context>
<context>
<name>CMySQLServer</name>
<message>
<source>Information</source>
<translation>Information</translation>
</message>
<message>
<source>Warning</source>
<translation>Warnung</translation>
</message>
<message>
<source>Critical</source>
<translation>Kritisch</translation>
</message>
<message>
<source>Message</source>
<translation>Nachricht</translation>
</message>
<message>
<source>ERROR</source>
<translation>FEHLER</translation>
</message>
<message>
<source>Password</source>
<translation>Passwort</translation>
</message>
<message>
<source>Please enter the Password for</source>
<translation>Bitte Passwort eingeben für</translation>
</message>
</context>
<context>
<name>CMyWindow</name>
<message>
<source>Messages</source>
<translation>Nachrichten</translation>
</message>
</context>
<context>
<name>COptionsMenu</name>
<message>
<source>&MDI</source>
<translation>&MDI</translation>
</message>
<message>
<source>&General</source>
<translation>&Allgemein</translation>
</message>
<message>
<source>&Themes</source>
<translation>&Themen</translation>
</message>
<message>
<source>&Options</source>
<translation>&Optionen</translation>
</message>
<message>
<source>&Printer Font</source>
<translation>&Druckerschriftart</translation>
</message>
<message>
<source>Restart</source>
<translation>Neu starten</translation>
</message>
<message>
<source>&Application Font</source>
<translation>&Applikationsschriftart</translation>
</message>
<message>
<source>&Query Editor Font</source>
<translation>Schriftart &Abfrageeditor</translation>
</message>
<message>
<source>&Fonts</source>
<translation>&Schriftarten</translation>
</message>
<message>
<source>MDI</source>
<translation></translation>
</message>
<message>
<source>Options</source>
<translation>Optionen</translation>
</message>
<message>
<source>General</source>
<translation>Allgemein</translation>
</message>
<message>
<source>Application Font</source>
<translation>Applikationsschriftart</translation>
</message>
<message>
<source>Options | Fonts</source>
<translation>Optionen | Schriftarten</translation>
</message>
<message>
<source>Printer Font</source>
<translation>Druckerschriftart</translation>
</message>
<message>
<source>Query Editor Font</source>
<translation>Schriftart Abfrageeditor</translation>
</message>
<message>
<source>You will need to restart mysqlcc before you notice your changes.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CPanel</name>
<message>
<source>Text Files (*.txt);;All Files(*.*)</source>
<translation>Textdateien (*.txt);;Alle Dateien(*.*)</translation>
</message>
</context>
<context>
<name>CPluginWindow</name>
<message>
<source>Critical</source>
<translation type="unfinished">Kritisch</translation>
</message>
<message>
<source>Warning</source>
<translation type="unfinished">Warnung</translation>
</message>
<message>
<source>Information</source>
<translation type="unfinished">Information</translation>
</message>
<message>
<source>Message</source>
<translation type="unfinished">Nachricht</translation>
</message>
</context>
<context>
<name>CPluginsConfigTab</name>
<message>
<source>Plugins</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click to browse for the Plugins Path.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Plugins Path</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the path where MySQLCC will search for plugins.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The Checked plugins will be enabled to be used in MySQLCC</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Available Plugins</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select the Translations Path</source>
<translation type="unfinished">Pfad für Übersetzungen wählen</translation>
</message>
</context>
<context>
<name>CPluginsMenu</name>
<message>
<source>Plugins</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&Plugins</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CProcessListTable</name>
<message>
<source>Process List Columns</source>
<translation>Spalte der Prozesslisten</translation>
</message>
<message>
<source>Choose Fields</source>
<translation>Felder auswählen</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>Process killed successfully</source>
<translation>Prozess erfolgreich beendet</translation>
</message>
<message>
<source>Process List</source>
<translation>Prozessliste</translation>
</message>
</context>
<context>
<name>CProperties</name>
<message>
<source>Refresh</source>
<translation>Aktualisieren</translation>
</message>
<message>
<source>&Refresh</source>
<translation>&Aktualisieren</translation>
</message>
<message>
<source>Connection</source>
<translation>Verbindung</translation>
</message>
<message>
<source>Host</source>
<translation>Rechner</translation>
</message>
<message>
<source>Saved</source>
<translation>Gespeichert</translation>
</message>
<message>
<source>Text Files (*.txt);;All Files(*.*)</source>
<translation>Textdateien (*.txt);;Alle Dateien(*.*)</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>Save</source>
<translation>Speichern</translation>
</message>
</context>
<context>
<name>CQueryConfigTab</name>
<message>
<source>Queries</source>
<translation>Abfragen</translation>
</message>
<message>
<source>Default Comment Style</source>
<translation>Standardstil für Anmerkungen</translation>
</message>
<message>
<source>Hash [ # Comment ]</source>
<translation>Rautenzeichen [ # Kommentar ]</translation>
</message>
<message>
<source>When selected, the Hash commenting style will be used.
Hash comments look as follows:
# Commented text</source>
<translation>Falls ausgewählt wird das Rautenzeichen für
Kommentare verwendet.
# Kommentare mit Rautenzeichen sehen wie folgt aus:
# Kommentierter Text</translation>
</message>
<message>
<source>Dash [ -- Comment ]</source>
<translation>Bindestrich [ -- Kommentar ]</translation>
</message>
<message>
<source>C-Style [ /* Comment */ ]</source>
<translation>C-Stil [ /* Kommentar */ ]</translation>
</message>
<message>
<source>When selected, the C-Style commenting style will be used.
C-Style comments look as follows:
/* Commented text */</source>
<translation>Falls ausgewählt wird C-Stil für Kommentare
verwendet.
# C-Stil Kommentare sehen wie folgt aus:
/* Kommentierter Text */</translation>
</message>
<message>
<source>Open Table Options</source>
<translation>Optionen für Tabelle öffnen</translation>
</message>
<message>
<source>Do not execute the query</source>
<translation>Abfrage nicht ausführen</translation>
</message>
<message>
<source>Retrieve all records</source>
<translation>Alle Datensätze abrufen</translation>
</message>
<message>
<source>Enable SQL Debug</source>
<translation>SQL Debug aktivieren</translation>
</message>
<message>
<source>This is the commenting style which will be used by default.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When selected, the Dash commenting style will be used.
Dash comments look as follows:
-- Commented text</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the action that will be taken when one double-clicks on a Table in the database tree</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This option will automatically issue a SELECT * FROM Table statement but will not execute the query.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This option will automatically execute a SELECT * FROM Table statement to retreive all the records in a Table.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This option will append each executed query to the SQL Debug Panel.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CQueryOptionsTab</name>
<message>
<source>Query Configuration Dialog</source>
<translation>Dialog Abfragekonfiguration</translation>
</message>
<message>
<source>SQL_BUFFER_RESULT</source>
<translation></translation>
</message>
<message>
<source>[DEFAULT]</source>
<translation></translation>
</message>
<message>
<source>0</source>
<translation></translation>
</message>
<message>
<source>1</source>
<translation></translation>
</message>
<message>
<source>SQL_BIG_SELECTS</source>
<translation></translation>
</message>
<message>
<source>SQL_LOG_OFF</source>
<translation></translation>
</message>
<message>
<source>SQL_QUOTE_SHOW_CREATE</source>
<translation></translation>
</message>
<message>
<source>LOW_PRIORITY_UPDATES</source>
<translation></translation>
</message>
<message>
<source>SQL_LOG_UPDATE</source>
<translation></translation>
</message>
<message>
<source>SQL_SAFE_UPDATES</source>
<translation></translation>
</message>
<message>
<source>2</source>
<translation></translation>
</message>
<message>
<source>Set query cache setting for this thread.</source>
<translation>Abfragecache-Einstellung für diesen Thread
setzen.</translation>
</message>
<message>
<source>AUTOCOMMIT</source>
<translation></translation>
</message>
<message>
<source>BIG_TABLES</source>
<translation></translation>
</message>
<message>
<source>SQL_AUTO_IS_NULL</source>
<translation></translation>
</message>
<message>
<source>QUERY_CACHE_TYPE</source>
<translation></translation>
</message>
<message>
<source>Force</source>
<translation>Erzwingen</translation>
</message>
<message>
<source>Continue even if we get an sql error</source>
<translation>Fortsetzen, selbst wenn ein SQL Fehler
auftritt</translation>
</message>
<message>
<source>Append to History View</source>
<translation>An Historienansicht anfügen</translation>
</message>
<message>
<source>Silent</source>
<translation>Still</translation>
</message>
<message>
<source>Query Options</source>
<translation>Abfrageoptionen</translation>
</message>
<message>
<source>If set to 1 all changes to a table will be done at once. To start a multi-command transaction, you have to use the BEGIN statement.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If set to 0, MySQL will abort if a SELECT is attempted that probably will take a very long time. This is useful when an inadvisable WHERE statement has been issued.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If set to 1, all INSERT, UPDATE, DELETE, and and LOCK TABLE WRITE statements wait until there is no pending SELECT or LOCK TABLE READ on the affected table.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If set to 1, all temporary tables are stored on disk rather than in memory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If set to 0, no logging will be done to the update log for the client, if the client has the SUPER privilege. This does not affect the standard log!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If set to 1, no logging will be done to the standard log for this client, if the client has the SUPER privilege. This does not affect the update log!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SQL_BUFFER_RESULT will force the result from SELECTs to be put into a temporary table. This will help MySQL free the table locks early and will help in cases where it takes a long time to send the result set to the client.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If set to 1, MySQL will abort if an UPDATE or DELETE is attempted that doesn't use a key or LIMIT in the WHERE clause. This makes it possible to catch wrong updates when creating SQL commands by hand.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If set to 1, SHOW CREATE TABLE will quote table and column names.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If set to 1 then one can find the last inserted row for a table with an AUTO_INCREMENT column with the following construct: WHERE auto_increment_column IS NULL.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source><B>NOTE:</B> The below options apply to <b>this</b> session only; the server's configuration will not be affected by these settings. All options set to '[DEFAULT]' will remain untouched.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When checked, each executed query will be appended to the History Panel.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When checked, no messages will be printed in the Messages Panel with the exception of errors.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CQuerySet</name>
<message>
<source>Query</source>
<translation>Abfrage</translation>
</message>
<message>
<source>Result</source>
<translation>Ergebnis</translation>
</message>
<message>
<source>Database Changed</source>
<translation>Datenbank geändert</translation>
</message>
<message>
<source>Error: You have mismatched</source>
<translation>Fehler: Sie haben falsch zugeordnet</translation>
</message>
<message>
<source>Query canceled by user</source>
<translation>Abfrage durch Benutzer abgebrochen</translation>
</message>
<message>
<source>No query specified</source>
<translation>Keine Abfrage angegeben</translation>
</message>
<message>
<source>Query in Database</source>
<translation>Datenbank abfragen</translation>
</message>
<message>
<source>Data in Table</source>
<translation>Daten in Tabelle</translation>
</message>
<message>
<source>in</source>
<translation>in</translation>
</message>
<message>
<source>Confirm Cancel</source>
<translation>Abbrechen bestätigen</translation>
</message>
<message>
<source>Are you sure you want to cancel Query</source>
<translation>Sind Sie sicher, dass sie die Abfrage abbrechen
wollen</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
</context>
<context>
<name>CQueryTable</name>
<message>
<source>Text Files (*.txt);;All Files(*.*)</source>
<translation>Textdateien (*.txt);;Alle Dateien(*.*)</translation>
</message>
<message>
<source>Replace File</source>
<translation>Datei ersetzen</translation>
</message>
<message>
<source>The specified file name already exists.
Do you want to replace it ?</source>
<translation>Der Dateiname existiert bereits.
Wollen Sie sie ersetzen?</translation>
</message>
<message>
<source>An error occurred while saving the file</source>
<translation>Beim Speichern der Datei ist ein Fehler
aufgetreten</translation>
</message>
<message>
<source>Connection</source>
<translation>Verbindung</translation>
</message>
<message>
<source>Host</source>
<translation>Rechner</translation>
</message>
<message>
<source>Saved</source>
<translation>Gespeichert</translation>
</message>
<message>
<source>Query</source>
<translation>Abfrage</translation>
</message>
<message>
<source>Successfully saved</source>
<translation>Erfolgreich gespeichert</translation>
</message>
</context>
<context>
<name>CQueryWindow</name>
<message>
<source>Open</source>
<translation>Öffnen</translation>
</message>
<message>
<source>Print</source>
<translation>Drucken</translation>
</message>
<message>
<source>Close</source>
<translation>Schließen</translation>
</message>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
<message>
<source>Undo</source>
<translation>Rückgängig</translation>
</message>
<message>
<source>&Undo</source>
<translation>&Rückgängig</translation>
</message>
<message>
<source>Redo</source>
<translation>Wiederholen</translation>
</message>
<message>
<source>&Redo</source>
<translation>&Wiederholen</translation>
</message>
<message>
<source>Cut</source>
<translation>Ausschneiden</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>Paste</source>
<translation>Einfügen</translation>
</message>
<message>
<source>&Paste</source>
<translation>&Einfügen</translation>
</message>
<message>
<source>&File</source>
<translation>&Datei</translation>
</message>
<message>
<source>&Edit</source>
<translation>&Bearbeiten</translation>
</message>
<message>
<source>SQL Pane</source>
<translation>SQL Feld</translation>
</message>
<message>
<source>&SQL Pane</source>
<translation>&SQL Feld</translation>
</message>
<message>
<source>Results Pane</source>
<translation>Ergebnisfeld</translation>
</message>
<message>
<source>Cancel Execution and Clear Results</source>
<translation>Ausführung beenden und Ergebnisse
zurücksetzen</translation>
</message>
<message>
<source>&Cancel</source>
<translation>&Abbrechen</translation>
</message>
<message>
<source>Query</source>
<translation>Abfrage</translation>
</message>
<message>
<source>&Query</source>
<translation>&Abfrage</translation>
</message>
<message>
<source>Field1</source>
<translation>Feld1</translation>
</message>
<message>
<source>Value1</source>
<translation>Wert1</translation>
</message>
<message>
<source>&Print</source>
<translation>&Drucken</translation>
</message>
<message>
<source>&Open</source>
<translation>Ö&ffnen</translation>
</message>
<message>
<source>History</source>
<translation>Historie</translation>
</message>
<message>
<source>Select Query</source>
<translation>Abfrage auswählen</translation>
</message>
<message>
<source>Update Query</source>
<translation>Abfrage aktualisieren</translation>
</message>
<message>
<source>Delete Query</source>
<translation>Abfrage löschen</translation>
</message>
<message>
<source>Clear Query</source>
<translation>Abfrage zurücksetzen</translation>
</message>
<message>
<source>Query Columns</source>
<translation>Spalten abfragen</translation>
</message>
<message>
<source>File</source>
<translation>Datei</translation>
</message>
<message>
<source>Save Query</source>
<translation>Abfrage speichern</translation>
</message>
<message>
<source>&Save Query</source>
<translation>An&frage speichern</translation>
</message>
<message>
<source>Save Results</source>
<translation>Ergebnisse speichern</translation>
</message>
<message>
<source>Save &Results</source>
<translation>Ergebnisse spe&ichern</translation>
</message>
<message>
<source>C&lear Query</source>
<translation>Abfrage zurüc&ksetzen</translation>
</message>
<message>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
<source>Cu&t</source>
<translation>Aus&schneiden</translation>
</message>
<message>
<source>&Copy</source>
<translation>&Kopieren</translation>
</message>
<message>
<source>View</source>
<translation>Ansicht</translation>
</message>
<message>
<source>&Results Pane</source>
<translation>Er&gebnisfeld</translation>
</message>
<message>
<source>Show Columns Window</source>
<translation>Spaltenfenster anzeigen</translation>
</message>
<message>
<source>Show Columns &Window</source>
<translation>Zeige S&paltenfenster</translation>
</message>
<message>
<source>Show Messages</source>
<translation>Zeige Nachrichten</translation>
</message>
<message>
<source>Show &Messages</source>
<translation>Zeige &Nachrichten</translation>
</message>
<message>
<source>Execute</source>
<translation>Ausführen</translation>
</message>
<message>
<source>&Execute</source>
<translation>Ausfü&hren</translation>
</message>
<message>
<source>General options for the Query Window</source>
<translation>Allgemeine Optionen für das
Abfragefenster</translation>
</message>
<message>
<source>&Query Window Options</source>
<translation>&Optionen Abfragefenster</translation>
</message>
<message>
<source>Options</source>
<translation>Optionen</translation>
</message>
<message>
<source>&View</source>
<translation>Ansich&t</translation>
</message>
<message>
<source>&Options</source>
<translation>O&ptionen</translation>
</message>
<message>
<source>File Bar</source>
<translation>Dateibalken</translation>
</message>
<message>
<source>Insert Query</source>
<translation>EinfügeAbfrage</translation>
</message>
<message>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<source>Edit Bar</source>
<translation>Bearbeitenbalken</translation>
</message>
<message>
<source>View Bar</source>
<translation>Ansichtsbalken</translation>
</message>
<message>
<source>Query Bar</source>
<translation>Abfragebalken</translation>
</message>
<message>
<source>Query Type</source>
<translation>Abfragetyp</translation>
</message>
<message>
<source>Query Window</source>
<translation>Abfragefenster</translation>
</message>
<message>
<source>Confirm Cancel</source>
<translation>Abbrechen bestätigen</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
<source>Explain</source>
<translation>Erklären</translation>
</message>
<message>
<source>Read Only</source>
<translation>Nur-Lesen</translation>
</message>
<message>
<source>Executing Query</source>
<translation>Führe Abfrage aus</translation>
</message>
<message>
<source>Insert Record</source>
<translation>Datensatz eintragen</translation>
</message>
<message>
<source>&Insert Record</source>
<translation>&Datensatz eintragen</translation>
</message>
<message>
<source>Delete Record</source>
<translation>Datensatz löschen</translation>
</message>
<message>
<source>&Delete Record</source>
<translation>Datensat&z löschen</translation>
</message>
<message>
<source>Save to Clipboard</source>
<translation>In Zwischenablage kopieren</translation>
</message>
<message>
<source>Save to &Clipboard</source>
<translation>In &Zwischenablage kopieren</translation>
</message>
<message>
<source>File | Save</source>
<translation>Datei | Speichern</translation>
</message>
<message>
<source>New Tab</source>
<translation>Neuer Reiter</translation>
</message>
<message>
<source>&New Tab</source>
<translation>&Neuer Reiter</translation>
</message>
<message>
<source>Delete Tab</source>
<translation>Reiter löschen</translation>
</message>
<message>
<source>&Delete Tab</source>
<translation>Reiter &löschen</translation>
</message>
<message>
<source>New Window From Tab</source>
<translation>Neues Fester vom Reiter</translation>
</message>
<message>
<source>New &Window From Tab</source>
<translation>Neues &Fenster vom Reiter</translation>
</message>
<message>
<source>First</source>
<translation>Zuerst</translation>
</message>
<message>
<source>&First</source>
<translation>Zu&erst</translation>
</message>
<message>
<source>View | Query Tabs</source>
<translation>Anzeigen | Abfragereiter</translation>
</message>
<message>
<source>Back</source>
<translation>Zurück</translation>
</message>
<message>
<source>&Back</source>
<translation>Zu&rück</translation>
</message>
<message>
<source>Toggle Previous</source>
<translation>Zu vorigem umschalten</translation>
</message>
<message>
<source>&Toggle Previous</source>
<translation>Zu &vorigem umschalten</translation>
</message>
<message>
<source>Next</source>
<translation>Nächster</translation>
</message>
<message>
<source>&Next</source>
<translation>&Nächster</translation>
</message>
<message>
<source>Last</source>
<translation>Letzter</translation>
</message>
<message>
<source>&Last</source>
<translation>&Letzer</translation>
</message>
<message>
<source>View | Result Tabs</source>
<translation>Anzeigen | Ergebnisreiter</translation>
</message>
<message>
<source>General</source>
<translation>Allgemein</translation>
</message>
<message>
<source>&General</source>
<translation>&Allgemein</translation>
</message>
<message>
<source>Query Tabs</source>
<translation>Abfragereiter</translation>
</message>
<message>
<source>Result Tabs</source>
<translation>Ergebnisreiter</translation>
</message>
<message>
<source>Confirm Close</source>
<translation>Schließen bestätigen</translation>
</message>
<message>
<source>Are you sure you want to close this Query Tab ?</source>
<translation>Sind Sie sicher, dass Sie diesen Abfragereier
schließen wollen?</translation>
</message>
<message>
<source>Trying to close window.</source>
<translation>Versuche das Fenster zu schließen.</translation>
</message>
<message>
<source>Automatically freed results for</source>
<translation>Automatisch freigesetzte Ergebnisse für</translation>
</message>
<message>
<source>Are you sure you want to kill all Query threads ?</source>
<translation>Sind Sie sicher, dass Sie alle Abfragethreads
abschießen wollen?</translation>
</message>
<message>
<source>Are you sure you want to cancel all Queries ?</source>
<translation>Sind Sie sicher, dass Sie alle Abfragen abbrechen
wollen?</translation>
</message>
<message>
<source>Waiting for Query Threads to terminate.</source>
<translation>Warte auf Beendigung der Abfragethreads.</translation>
</message>
</context>
<context>
<name>CQueryWindowOptionsDialog</name>
<message>
<source>Query Configuration Dialog</source>
<translation>Dialog Abfragekonfiguration</translation>
</message>
<message>
<source>&Apply</source>
<translation>&Übernehmen</translation>
</message>
<message>
<source>Click to Apply changes.</source>
<translation>Klicken um Änderungen zu übernehmen.</translation>
</message>
<message>
<source>Query configuration updated successfully</source>
<translation>Abfragekonfiguration erfolgerich
aktualisiert</translation>
</message>
<message>
<source>An error occurred while saving the Query configuration</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CQueryWindowOptionsTab</name>
<message>
<source>Query Window Options</source>
<translation>Abfragefensteroptionen</translation>
</message>
<message>
<source>Execute everything in the same Query Tab</source>
<translation>Alles im gleichen Abfragereiter
ausführen</translation>
</message>
<message>
<source>Create a new Query Window for each Query</source>
<translation>Ein neues Abfragefenster für jede Abfrage
anlegen</translation>
</message>
<message>
<source>Unlimited</source>
<translation>Unbegrenzt</translation>
</message>
<message>
<source>Maximum number of Results to Save:</source>
<translation>Maximale Anzahl Ergebnisse zu speichern:</translation>
</message>
<message>
<source>When changing a Result Tab, automatically set the corresponding Query Tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When executing a Query, automatically create a new Tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When executing Multiple Queries that return a Result Set</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When changing a Query Tab, automatically set the corresponding Result Tab</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CRegisterServerDialog</name>
<message>
<source>Register Server</source>
<translation>Server registrieren</translation>
</message>
<message>
<source>&Test</source>
<translation>&Test</translation>
</message>
<message>
<source>Click here to test the connection.</source>
<translation>Hier klicken um die Verbindung zu testen.</translation>
</message>
<message>
<source>&Apply</source>
<translation>&Übernehmen</translation>
</message>
<message>
<source>Click to Apply changes to this connection.</source>
<translation>Hier klicken um Änderungen für diese Verbindung zu
übernehmen.</translation>
</message>
<message>
<source>&Add</source>
<translation>&Hinzufügen</translation>
</message>
<message>
<source>Click to Add a new connection.</source>
<translation>Hier klicken um eine neue Verbindung
hinzuzufügen.</translation>
</message>
<message>
<source>Testing connection to MySQL Server ...</source>
<translation>Prüfe die Verbindung zum MySQL Server
...</translation>
</message>
<message>
<source>connecting ...</source>
<translation>verbinde ...</translation>
</message>
<message>
<source>Connection Successful.</source>
<translation>Verbindung erfolgreich.</translation>
</message>
<message>
<source>A Connection with that name already exists.</source>
<translation>Eine Verbindung mit diesem Namen besteht
bereits.</translation>
</message>
<message>
<source>An Error occurred while saving the Connection.</source>
<translation>Beim Speichern der Verbindung ist ein Fehler
aufgetreten.</translation>
</message>
<message>
<source>Connection edited successfully.</source>
<translation>Verbindung erfolgreich bearbeitet.</translation>
</message>
<message>
<source>Connection added successfully.</source>
<translation>Verbindung erfolgreich hinzugefügt.</translation>
</message>
<message>
<source>An error occured while saving the temporary connection.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A Connection with that name already exists. The following connection name was used</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CSaveServerOptionsTab</name>
<message>
<source>Save Options</source>
<translation>Optionen Speichern</translation>
</message>
<message>
<source>Fields Separated by</source>
<translation>Felder getrennt durch</translation>
</message>
<message>
<source>Fields enclosed by</source>
<translation>Felder eingeschlossen durch</translation>
</message>
<message>
<source>Lines terminated by</source>
<translation>Zeilen abgeschlossen duch</translation>
</message>
<message>
<source>Replace emtpy fields with</source>
<translation>Leere Felder ersetzen durch</translation>
</message>
<message>
<source>The specified character will be used to Separate fields whenever you save a text file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The specified character will be appended to all the lines whenever you save a text file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The specified character will be used to Enclose each field whenever you save a text file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All Empty fields will be replaced with what you type in this box for whenever you save a text file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You can use the following escaped symbols to represent certain escaped characters:<br>
<b>\n</b> New Line<br>
<b>\r</b> Carriage Return<br>
<b>\t</b> Tab</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CServerAdministrationItem</name>
<message>
<source>Server Administration</source>
<translation>Serveradministration</translation>
</message>
<message>
<source>Show Process List</source>
<translation>Zeige Prozessliste</translation>
</message>
<message>
<source>Show Status</source>
<translation>Zeige Status</translation>
</message>
<message>
<source>Show Variables</source>
<translation>Zeige Variablen</translation>
</message>
<message>
<source>Flush</source>
<translation>Bereinigen</translation>
</message>
<message>
<source>Ping</source>
<translation>Ping</translation>
</message>
<message>
<source>Shutdown</source>
<translation>Beenden</translation>
</message>
<message>
<source>New &Window from Here</source>
<translation>Neues &Fenster ab hier</translation>
</message>
</context>
<context>
<name>CServerItem</name>
<message>
<source>Delete Server</source>
<translation>Server löschen</translation>
</message>
<message>
<source>Are you sure you want to Delete Server</source>
<translation>Sind Sie sicher, dass Sie diesen Server löschen
wollen?</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
<source>&Connect</source>
<translation>&Verbinden</translation>
</message>
<message>
<source>&Disconnect</source>
<translation>&Trennen</translation>
</message>
<message>
<source>&Edit</source>
<translation>&Bearbeiten</translation>
</message>
<message>
<source>De&lete</source>
<translation>&Löschen</translation>
</message>
<message>
<source>&Rename</source>
<translation>&Umbenennen</translation>
</message>
<message>
<source>New &Window from Here</source>
<translation>Neues &Fenster ab hier</translation>
</message>
</context>
<context>
<name>CServerStatusTable</name>
<message>
<source>Server Status Columns</source>
<translation>Serverstatus Spalten</translation>
</message>
<message>
<source>Choose Fields</source>
<translation>Felder auswählen</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>Clear Grid</source>
<translation>Raster zurücksetzen</translation>
</message>
<message>
<source>Server Status</source>
<translation>Serverstatus</translation>
</message>
<message>
<source>Horizontal Mode</source>
<translation>Horizontaler Moduls</translation>
</message>
<message>
<source>Vertical Mode</source>
<translation>Vertikaler Modus</translation>
</message>
</context>
<context>
<name>CShowDatabaseGroupProperties</name>
<message>
<source>Property</source>
<translation>Eigenschaft</translation>
</message>
<message>
<source>Value</source>
<translation>Wert</translation>
</message>
<message>
<source>Database Status</source>
<translation>Datenbankstatus</translation>
</message>
</context>
<context>
<name>CShowServerProperties</name>
<message>
<source>Property</source>
<translation>Eigenschaft</translation>
</message>
<message>
<source>Value</source>
<translation>Wert</translation>
</message>
<message>
<source>Connected</source>
<translation>Verbunden</translation>
</message>
<message>
<source>Host Name</source>
<translation>Rechnername</translation>
</message>
<message>
<source>User Name</source>
<translation>Benutzername</translation>
</message>
<message>
<source>Using Blocking Queries</source>
<translation>Verwendet blockierende Abfragen</translation>
</message>
<message>
<source>Using Compression</source>
<translation>Verwendet Kompression</translation>
</message>
<message>
<source>Using Prompt for Password</source>
<translation>Verwendet Abfrage des Passworts</translation>
</message>
<message>
<source>Using a Single Connection</source>
<translation>Verwendet eine einzelne Verbindung</translation>
</message>
<message>
<source>Socket File</source>
<translation>Socket Datei</translation>
</message>
<message>
<source>Port</source>
<translation>Port</translation>
</message>
<message>
<source>MySQL Server version</source>
<translation>MySQL Server version</translation>
</message>
<message>
<source>MySQL Protocol version</source>
<translation>MySQL Protokollversion</translation>
</message>
<message>
<source>MySQL Connection version</source>
<translation>MySQL Verbindungsart</translation>
</message>
<message>
<source>MySQL Uptime</source>
<translation>MySQL läuft</translation>
</message>
<message>
<source>Connection Properties</source>
<translation>Verbindungseigenschaften</translation>
</message>
<message>
<source>Date Created</source>
<translation>Erzeugungsdatum</translation>
</message>
<message>
<source>Date Modified</source>
<translation>Modifikationsdatum</translation>
</message>
<message>
<source>Has Syntax Highlighting and Completion</source>
<translation>Verwendet Abschluß- und
Syntaxhervorhebung</translation>
</message>
<message>
<source>Fields Separated by</source>
<translation>Felder getrennt durch</translation>
</message>
<message>
<source>Fields Enclosed by</source>
<translation>Felder eingeschlossen durch</translation>
</message>
<message>
<source>Lines Terminated by</source>
<translation>Zeilen abgeschlossen duch</translation>
</message>
<message>
<source>Replace Empty fields with</source>
<translation>Leere Felder ersetzen durch</translation>
</message>
<message>
<source>Using SSL</source>
<translation>Verwendet SSL</translation>
</message>
</context>
<context>
<name>CShowTableProperties</name>
<message>
<source>&Edit Table</source>
<translation>Tab&elle bearbeiten</translation>
</message>
<message>
<source>&Refresh Fields</source>
<translation>Felde&r aktualisieren</translation>
</message>
</context>
<context>
<name>CSqlDebugPanel</name>
<message>
<source>SQL Debug</source>
<translation>SQL Debuggen</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<source>Clear</source>
<translation>Zurücksetzen</translation>
</message>
</context>
<context>
<name>CSqlEditor</name>
<message>
<source>Connection</source>
<translation>Verbindung</translation>
</message>
<message>
<source>Host</source>
<translation>Rechner</translation>
</message>
<message>
<source>Saved</source>
<translation>Gespeichert</translation>
</message>
<message>
<source>SQL Files (*.sql);;All Files(*.*)</source>
<translation>SQL Dateien (*.txt);;Alle Dateien(*.*)</translation>
</message>
<message>
<source>SQL Files</source>
<translation>SQL Dateien</translation>
</message>
<message>
<source>Text Files</source>
<translation>Textdateien</translation>
</message>
<message>
<source>All Files</source>
<translation>Alle Dateien</translation>
</message>
<message>
<source>Could not load Syntax File</source>
<translation>Konnte Syntaxdatei nicht laden</translation>
</message>
</context>
<context>
<name>CSqlEditorConfigTab</name>
<message>
<source>Sql Editor</source>
<translation>SQL Editor</translation>
</message>
<message>
<source>Enable Parentheses Matching</source>
<translation>Klammernzuordnung aktivieren</translation>
</message>
<message>
<source>Enable Linux Copy / Paste Style</source>
<translation>Linux Bearbeiten / Einfügen Stil
ermöglichen</translation>
</message>
<message>
<source>Syntax File</source>
<translation>Syntaxdatei</translation>
</message>
<message>
<source>Text Files</source>
<translation>Textdateien</translation>
</message>
<message>
<source>All Files</source>
<translation>Alle Dateien</translation>
</message>
<message>
<source>Select the Syntax File</source>
<translation>Wählen Sie die Syntaxdatei</translation>
</message>
<message>
<source>When enabled, the SQL Editor will use Parentheses Matching.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When enabled, the SQL Editor will emulate the way Linux works for Copy & Paste. When text is selected, it will automatically be copied in to the buffer and when the mid-mouse button is clicked, it will be pasted at the current cursor position.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the File that contains the list of keywords that will be highlighted and completed by the SQL Editor.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select the Folder that contains the Translation Files.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable SQL Syntax Highlighting && Completion</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>When enabled, the SQL Editor will use Syntax Highlighting for SQL Keywords and will also have support for Keyword completion.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source></source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CSqlTable</name>
<message>
<source>All Files(*.*)</source>
<translation>Alle Dateien (*)</translation>
</message>
<message>
<source>Load from File</source>
<translation>Aus Datei laden</translation>
</message>
<message>
<source>Text Files (*.txt)</source>
<translation>Textdateien (*.txt)</translation>
</message>
<message>
<source>Choose a file</source>
<translation>Datei auswählen</translation>
</message>
<message>
<source>An error occurred while opening the file.</source>
<translation>Beim Öffnen der Datei ist ein Fehler
aufgetreten.</translation>
</message>
<message>
<source>There is not enough memory to open the file</source>
<translation>Nicht genügend Speicher zum Öffnen der
Datei</translation>
</message>
<message>
<source>Image &Viewer</source>
<translation>&Bildbetrachter</translation>
</message>
<message>
<source>&Text Editor</source>
<translation>&Texteditor</translation>
</message>
<message>
<source>Open in</source>
<translation>Öffnen in</translation>
</message>
<message>
<source>&Load from File</source>
<translation>&Aus Datei laden</translation>
</message>
<message>
<source>&Save to File</source>
<translation>In Datei ab&speichern</translation>
</message>
<message>
<source>&Copy</source>
<translation>&Kopieren</translation>
</message>
<message>
<source>Save &Results</source>
<translation>Ergebnisse spe&ichern</translation>
</message>
<message>
<source>C&lear Grid</source>
<translation>Raster &löschen</translation>
</message>
<message>
<source>Confirm Delete</source>
<translation>Löschen bestätigen</translation>
</message>
<message>
<source>&Insert Record</source>
<translation>Datensatz &einfügen</translation>
</message>
<message>
<source>&Delete Record</source>
<translation>Datensatz &löschen</translation>
</message>
<message>
<source>Are you sure you want to Delete the selected records ?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CSyntaxHighlightConfigTab</name>
<message>
<source>Syntax Highlighting</source>
<translation>Syntaxhervorhebung</translation>
</message>
<message>
<source>Preview of this section.</source>
<translation>Vorschau für diesen Abschnitt.</translation>
</message>
<message>
<source>Underline</source>
<translation>Unterstreichen</translation>
</message>
<message>
<source>The font for this section will be Underlined.</source>
<translation>Die Schrift für diesen Abschnitt wird
unterstrichen.</translation>
</message>
<message>
<source>Size</source>
<translation>Größe</translation>
</message>
<message>
<source>Italic</source>
<translation>Kursiv</translation>
</message>
<message>
<source>The font for this section will be Italic.</source>
<translation>Die Schrift in diesem Abschnitt wird kursiv dargestellt
werden.</translation>
</message>
<message>
<source>Preview</source>
<translation>Vorschau</translation>
</message>
<message>
<source>Bold</source>
<translation>Fett</translation>
</message>
<message>
<source>The font for this section will be Bold.</source>
<translation>Die Schrift in diesem Abschnitt wird fett dargestellt
werden.</translation>
</message>
<message>
<source>Font</source>
<translation>Schrift</translation>
</message>
<message>
<source>Color</source>
<translation>Farbe</translation>
</message>
<message>
<source>Restore Defaults</source>
<translation>Standard wiederherstellen</translation>
</message>
<message>
<source>Available Sections for the SQL Editor.
If you want to modify multiple entries at once, select all the sections you want to modify by using the CRTL key and either the mouse or the up, down and space-bar keys.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the font Size that will be used for this particular section.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the Font that will be used for this particular section.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the font Color that will be used for this particular section.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source></source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CTable</name>
<message>
<source>Connection</source>
<translation>Verbindung</translation>
</message>
<message>
<source>Host</source>
<translation>Rechner</translation>
</message>
<message>
<source>Saved</source>
<translation>Gespeichert</translation>
</message>
</context>
<context>
<name>CTableFieldChooser</name>
<message>
<source>Table Columns</source>
<translation>Tabellenspalten</translation>
</message>
<message>
<source>Columns</source>
<translation>Spalten</translation>
</message>
<message>
<source>Select the columns that you want visible in the grid.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CTableFieldChooserListView</name>
<message>
<source>Check All</source>
<translation>Alle auswählen</translation>
</message>
<message>
<source>Clear All</source>
<translation>Alle zurücksetzen</translation>
</message>
</context>
<context>
<name>CTableGroupItem</name>
<message>
<source>Return &all rows</source>
<translation>&Alle Zeilen zurückliefern</translation>
</message>
<message>
<source>Return &Limit</source>
<translation>&Limit zurückgeben</translation>
</message>
<message>
<source>Tables</source>
<translation>Tabellen</translation>
</message>
<message>
<source>Table</source>
<translation>Tabelle</translation>
</message>
<message>
<source>Records</source>
<translation>Datensätze</translation>
</message>
<message>
<source>Size (bytes)</source>
<translation>Größe (bytes)</translation>
</message>
<message>
<source>Created</source>
<translation>Erzeugt</translation>
</message>
<message>
<source>Type</source>
<translation>Typ</translation>
</message>
<message>
<source>Comments</source>
<translation>Anmerkungen</translation>
</message>
<message>
<source>&New Table</source>
<translation>&Neue Tabelle</translation>
</message>
<message>
<source>&Tools</source>
<translation>&Werkzeuge</translation>
</message>
<message>
<source>&Import</source>
<translation>&Import</translation>
</message>
<message>
<source>&Refresh</source>
<translation>&Aktualisieren</translation>
</message>
<message>
<source>New &Window from Here</source>
<translation>Neues &Fenster ab hier</translation>
</message>
<message>
<source>Querying MySQL Server for Table information in database:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CTableIndexes</name>
<message>
<source>Indexes</source>
<translation>Indexe</translation>
</message>
<message>
<source>Available Fields</source>
<translation>Verfügbare Felder</translation>
</message>
<message>
<source>Fields Used</source>
<translation>Verwendete Felder</translation>
</message>
<message>
<source>Fields used in this Index</source>
<translation>In diesem Index verwendete Felder</translation>
</message>
<message>
<source>Available Fields that can be used as an Index</source>
<translation>Verfügbare Felder, die als ein Index verwendet werden
können</translation>
</message>
<message>
<source>Index Name</source>
<translation>Indexname</translation>
</message>
<message>
<source>Delete selected Index</source>
<translation>Ausgewählten Index löschen</translation>
</message>
<message>
<source>Available Index Names</source>
<translation>Verfügbare Indexnamen</translation>
</message>
<message>
<source>Index Type</source>
<translation>Indextyp</translation>
</message>
<message>
<source>Type of Index for 'Index Name'</source>
<translation>Indextyp für 'Indexname'</translation>
</message>
<message>
<source>Add new Index</source>
<translation>Neuen Index hinzufügen</translation>
</message>
<message>
<source>New Index</source>
<translation>Neuer Index</translation>
</message>
<message>
<source>Please enter the Index Name</source>
<translation>Bitte geben Sie den Indexnamen ein</translation>
</message>
<message>
<source>You can not have an Index named 'PRIMARY'</source>
<translation>Sie können den Index nicht 'PRIMARY'
nennen</translation>
</message>
<message>
<source>Confirm Delete</source>
<translation>Löschen bestätigen</translation>
</message>
<message>
<source>Are you sure you want to Delete Index</source>
<translation>Sind Sie sicher, dass Sie den Index löschen
wollen?</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
<source>You already have an index called</source>
<translation>Sie haben bereits einen Index mit dem
Namen</translation>
</message>
<message>
<source>INDEX</source>
<translation></translation>
</message>
<message>
<source>UNIQUE</source>
<translation></translation>
</message>
<message>
<source>FULLTEXT</source>
<translation></translation>
</message>
<message>
<source>Enter the Index Length</source>
<translation>Indexlänge eingeben</translation>
</message>
<message>
<source>Index Length</source>
<translation>Indexlänge</translation>
</message>
<message>
<source></source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CTableItem</name>
<message>
<source>&Open Table</source>
<translation>Tabelle ö&ffnen</translation>
</message>
<message>
<source>&Edit Table</source>
<translation>Tabelle b&earbeiten</translation>
</message>
<message>
<source>&Properties</source>
<translation>&Eigenschaften</translation>
</message>
<message>
<source>E&xport Table</source>
<translation>Tabelle e&xportieren</translation>
</message>
<message>
<source>&Tools</source>
<translation>&Werkzeuge</translation>
</message>
<message>
<source>E&mpty Table</source>
<translation>Tabelle l&eeren</translation>
</message>
<message>
<source>D&rop Table</source>
<translation>Tabelle &löschen</translation>
</message>
<message>
<source>Re&name</source>
<translation>&Umbenennen</translation>
</message>
<message>
<source>&Refresh Fields</source>
<translation>Felder &aktualisieren</translation>
</message>
</context>
<context>
<name>CTableProperties</name>
<message>
<source>Table Properties</source>
<translation>Tabelleneigenschaften</translation>
</message>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
<message>
<source>Close this Dialog.</source>
<translation>Diesen Dialog schließen.</translation>
</message>
</context>
<context>
<name>CTablePropertiesWidget</name>
<message>
<source>Property</source>
<translation>Eigenschaft</translation>
</message>
<message>
<source>Value</source>
<translation>Wert</translation>
</message>
<message>
<source>Table Properties</source>
<translation>Tabelleneigenschaften</translation>
</message>
<message>
<source>Table</source>
<translation>Tabelle</translation>
</message>
<message>
<source>Database</source>
<translation>Datenbank</translation>
</message>
</context>
<context>
<name>CTableTools</name>
<message>
<source>Select one or more Tables.</source>
<translation>Eine oder mehrere Tabellen wählen.</translation>
</message>
<message>
<source>Analyze Table</source>
<translation>Tabelle analysieren</translation>
</message>
<message>
<source>Check Table</source>
<translation>Tabelle prüfen</translation>
</message>
<message>
<source>Optimize Table</source>
<translation>Tabelle optimieren</translation>
</message>
<message>
<source>Repair Table</source>
<translation>Tabelle reparieren</translation>
</message>
<message>
<source>Show Create</source>
<translation>Zeige das Erzeugen</translation>
</message>
<message>
<source>Options</source>
<translation>Optionen</translation>
</message>
<message>
<source>Click to execute.</source>
<translation>Zur Auführung hier klicken.</translation>
</message>
<message>
<source>Close this Dialog without executing.</source>
<translation>Diesen Dialog beenden ohne auszuführen.</translation>
</message>
<message>
<source>Show Create Table</source>
<translation>Zeige das Erzeugen der Tabelle</translation>
</message>
<message>
<source>&Execute</source>
<translation>&Ausführen</translation>
</message>
<message>
<source>&Cancel</source>
<translation>&Abbrechen</translation>
</message>
<message>
<source>Error</source>
<translation>Fehler</translation>
</message>
<message>
<source>You must select at least one Table.</source>
<translation>Sie müssen mindestens eine Tabelle
auswählen.</translation>
</message>
<message>
<source>&Analyze</source>
<translation>&Analysieren</translation>
</message>
<message>
<source>C&heck</source>
<translation>&Prüfen</translation>
</message>
<message>
<source>&Optimize</source>
<translation>&Optimieren</translation>
</message>
<message>
<source>&Repair</source>
<translation>&Reparieren</translation>
</message>
<message>
<source>Host</source>
<translation>Rechner</translation>
</message>
<message>
<source>Database</source>
<translation>Datenbank</translation>
</message>
<message>
<source>Table</source>
<translation>Tabelle</translation>
</message>
</context>
<context>
<name>CTableWindow</name>
<message>
<source>Editing Table</source>
<translation>Bearbeite Tabelle</translation>
</message>
<message>
<source>Creating Table</source>
<translation>Erzeuge Tabelle</translation>
</message>
<message>
<source>in database</source>
<translation>in der Datenbank</translation>
</message>
<message>
<source>Field Types loaded correctly.</source>
<translation>Feldtypen korrekt geladen.</translation>
</message>
<message>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<source>&Save</source>
<translation>&Speichern</translation>
</message>
<message>
<source>Save As</source>
<translation>Speichern als</translation>
</message>
<message>
<source>Close</source>
<translation>Schließen</translation>
</message>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
<message>
<source>Reload</source>
<translation>Neu laden</translation>
</message>
<message>
<source>&Reload</source>
<translation>&Neu laden</translation>
</message>
<message>
<source>Insert Row</source>
<translation>Zeile einfügen</translation>
</message>
<message>
<source>&Insert Row</source>
<translation>Zeile &einfügen</translation>
</message>
<message>
<source>Delete Row</source>
<translation>Zeile löschen</translation>
</message>
<message>
<source>&Delete Row</source>
<translation>&Zeile löschen</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>&Copy</source>
<translation>&Kopieren</translation>
</message>
<message>
<source>Paste</source>
<translation>Einfügen</translation>
</message>
<message>
<source>&Paste</source>
<translation>&Einfügen</translation>
</message>
<message>
<source>File</source>
<translation>Datei</translation>
</message>
<message>
<source>Table</source>
<translation>Tabelle</translation>
</message>
<message>
<source>&File</source>
<translation>&Datei</translation>
</message>
<message>
<source>&Edit</source>
<translation>B&earbeiten</translation>
</message>
<message>
<source>&Table</source>
<translation>&Tabelle</translation>
</message>
<message>
<source>You already have a Field Name called</source>
<translation>Sie haben bereits ein Feld mit dem Namen</translation>
</message>
<message>
<source>You must have at least one field in the table</source>
<translation>Sie müssen mindestens ein Feld in der Tabelle
festlegen</translation>
</message>
<message>
<source>Field Name</source>
<translation>Feldname</translation>
</message>
<message>
<source>Allow NULL</source>
<translation>NULL erlauben</translation>
</message>
<message>
<source>Data Type</source>
<translation>Datentyp</translation>
</message>
<message>
<source>Save Changes</source>
<translation>Änderungen speichern</translation>
</message>
<message>
<source>Do you want to save your changes ?</source>
<translation>Wollen Sie ihre Änderungen speichern?</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
<source>Table Name</source>
<translation>Tabellenname</translation>
</message>
<message>
<source>Please enter the Table Name</source>
<translation>Bitte Tabellennamen eingeben</translation>
</message>
<message>
<source>Table created successfully.</source>
<translation>Tabelle erfolgreich angelegt.</translation>
</message>
<message>
<source>Table modified successfully.</source>
<translation>Tabelle erfolgreich modifiziert.</translation>
</message>
<message>
<source>Save Table As</source>
<translation>Tabelle speichern als</translation>
</message>
<message>
<source>Please enter the new Table Name</source>
<translation>Bitte geben Sie den neuen Tabellennamen
ein</translation>
</message>
<message>
<source>The original Table Name will be used</source>
<translation>Der ursprüngliche Tabellenname wird
verwendet</translation>
</message>
<message>
<source>Add Primary Key</source>
<translation>Primärschlüssel hinzufügen</translation>
</message>
<message>
<source>Drop Primary Key</source>
<translation>Primärschlüssel entfernen</translation>
</message>
<message>
<source>Dr&op Primary Key</source>
<translation>P&rimärschlüssel entfernen</translation>
</message>
<message>
<source>Add Primary &Key</source>
<translation>&Primärschlüssel hinzufügen</translation>
</message>
<message>
<source>Field Properties</source>
<translation>Feldeigenschaften</translation>
</message>
<message>
<source>Indexes</source>
<translation>Indexe</translation>
</message>
<message>
<source>Table Properties</source>
<translation>Tabelleneigenschaften</translation>
</message>
<message>
<source>Alter Table Options</source>
<translation>Tabellenänderungsoptionen</translation>
</message>
<message>
<source>Save &As</source>
<translation>Speichern &als</translation>
</message>
<message>
<source>Show Messages</source>
<translation>Zeige Nachrichten</translation>
</message>
<message>
<source>Show &Messages</source>
<translation>Zeige &Nachrichten</translation>
</message>
<message>
<source>View</source>
<translation>Ansicht</translation>
</message>
<message>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
<source>&View</source>
<translation>&Ansicht</translation>
</message>
<message>
<source>This feature is not supported for your mysqld server version. You should upgrade to a newer version ASAP !!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not load Field Types. Please select the location of the Syntax File in 'Options->General->Sql Editor' and re-open this dialog.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All VARCHAR fields must have Length defined...Using the default field length.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>All ENUM and SET fields must have a Value separated by commas.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CTablesListBox</name>
<message>
<source>Refresh</source>
<translation>Aktualisieren</translation>
</message>
</context>
<context>
<name>CTblProperties</name>
<message>
<source>Table Properties</source>
<translation>Tabelleneigenschaften</translation>
</message>
<message>
<source>Delay Key Write</source>
<translation>Schlüssel schreiben verzögern</translation>
</message>
<message>
<source>Pack Keys</source>
<translation>Schlüssel packen</translation>
</message>
<message>
<source>Max Rows</source>
<translation>Maximale Zeilenzahl</translation>
</message>
<message>
<source>Table Type</source>
<translation>Tabellentyp</translation>
</message>
<message>
<source>Row Format</source>
<translation>Zeilenformat</translation>
</message>
<message>
<source>Table Name</source>
<translation>Tabellenname</translation>
</message>
<message>
<source>Avg. Row Length</source>
<translation>Durchschn. Zeilenlänge</translation>
</message>
<message>
<source>Checksum</source>
<translation>Prüfsumme</translation>
</message>
<message>
<source>Min Rows</source>
<translation>Minimale Zeilenzahl</translation>
</message>
<message>
<source>Comment</source>
<translation>Anmerkung</translation>
</message>
<message>
<source>Auto Increment</source>
<translation></translation>
</message>
<message>
<source>MyISAM</source>
<translation></translation>
</message>
<message>
<source>InnoDB</source>
<translation></translation>
</message>
<message>
<source>HEAP</source>
<translation></translation>
</message>
<message>
<source>BDB</source>
<translation></translation>
</message>
<message>
<source>ISAM</source>
<translation></translation>
</message>
<message>
<source>DEFAULT</source>
<translation></translation>
</message>
<message>
<source>DYNAMIC</source>
<translation></translation>
</message>
<message>
<source>FIXED</source>
<translation></translation>
</message>
<message>
<source>COMPRESSED</source>
<translation></translation>
</message>
<message>
<source>0</source>
<translation></translation>
</message>
<message>
<source>1</source>
<translation></translation>
</message>
<message>
<source>[DEFAULT]</source>
<translation></translation>
</message>
</context>
<context>
<name>CTextDialog</name>
<message>
<source>Text</source>
<translation>Text</translation>
</message>
<message>
<source>Enter Text</source>
<translation>Text eingeben</translation>
</message>
<message>
<source>&Cancel</source>
<translation>&Abbrechen</translation>
</message>
<message>
<source>Close this dialog</source>
<translation>Diesen Dialog schließen</translation>
</message>
<message>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<source>Click to Accept changes</source>
<translation>Hier klicken um Änderungen zu
übernehmen</translation>
</message>
</context>
<context>
<name>CTextFieldEditor</name>
<message>
<source>Open</source>
<translation>Öffnen</translation>
</message>
<message>
<source>&Open</source>
<translation>Ö&ffnen</translation>
</message>
<message>
<source>Save As</source>
<translation>Speichern als</translation>
</message>
<message>
<source>Save &As</source>
<translation>Speichern &als</translation>
</message>
<message>
<source>Print</source>
<translation>Drucken</translation>
</message>
<message>
<source>&Print</source>
<translation>&Drucken</translation>
</message>
<message>
<source>Undo</source>
<translation>Rückgängig</translation>
</message>
<message>
<source>&Undo</source>
<translation>&Rückgängig</translation>
</message>
<message>
<source>Redo</source>
<translation>Wiederholen</translation>
</message>
<message>
<source>&Redo</source>
<translation>&Wiederholen</translation>
</message>
<message>
<source>Cut</source>
<translation>Ausschneiden</translation>
</message>
<message>
<source>&Cut</source>
<translation>&Ausschneiden</translation>
</message>
<message>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<source>Paste</source>
<translation>Einfügen</translation>
</message>
<message>
<source>&Paste</source>
<translation>&Einfügen</translation>
</message>
<message>
<source>Tools</source>
<translation>Werkzeuge</translation>
</message>
<message>
<source>&File</source>
<translation>&Datei</translation>
</message>
<message>
<source>&Edit</source>
<translation>&Bearbeiten</translation>
</message>
<message>
<source>Close</source>
<translation>Schließen</translation>
</message>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
<message>
<source>Text Field Editor</source>
<translation>Textfeld Editor</translation>
</message>
<message>
<source>Column</source>
<translation>Spalte</translation>
</message>
<message>
<source>File</source>
<translation>Datei</translation>
</message>
<message>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
<source>&Copy</source>
<translation>&Kopieren</translation>
</message>
<message>
<source>Text Files (*.txt);;All Files(*.*)</source>
<translation>Textdateien (*.txt);;Alle Dateien(*.*)</translation>
</message>
<message>
<source>Text Files</source>
<translation>Textdateien</translation>
</message>
<message>
<source>All Files</source>
<translation>Alle Dateien</translation>
</message>
</context>
<context>
<name>CUserAdminItem</name>
<message>
<source>User Administration</source>
<translation>Benutzerverwaltung</translation>
</message>
<message>
<source>&Disconnect</source>
<translation>&Trennen</translation>
</message>
<message>
<source>&Connect</source>
<translation>&Verbinden</translation>
</message>
<message>
<source>New &Window from Here</source>
<translation>Neues &Fenster ab hier</translation>
</message>
<message>
<source>You don't have enough privileges to access this section</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CUserAdminWindow</name>
<message>
<source>Add User</source>
<translation>Benutzer hinzufügen</translation>
</message>
<message>
<source>Edit User</source>
<translation>Benutzer bearbeiten</translation>
</message>
<message>
<source>Privileges</source>
<translation>Privilegien</translation>
</message>
<message>
<source>With GRANT option</source>
<translation>Mit GRANTOption</translation>
</message>
<message>
<source>All Privileges</source>
<translation>Alle Privilegien</translation>
</message>
<message>
<source>This option will GRANT ALL PRIVILEGES to Username</source>
<translation>Diese Option wird dem Benutzer GRANT ALL PRIVILEGES
(alle) Privilegien gewähren</translation>
</message>
<message>
<source>Select the desired Privileges for Username</source>
<translation>Wählen Sie die gewünschten Privilegien für den
Benutzernamen</translation>
</message>
<message>
<source>Host</source>
<translation>Rechner</translation>
</message>
<message>
<source>Password</source>
<translation>Passwort</translation>
</message>
<message>
<source>Username</source>
<translation>Benutzername</translation>
</message>
<message>
<source>This is the Password for Username.</source>
<translation>Dies ist das Passwort für den
Benutzernamen.</translation>
</message>
<message>
<source>Allow access to</source>
<translation>Zugang erlauben zu</translation>
</message>
<message>
<source>Global Privileges</source>
<translation>Globale Privilegien</translation>
</message>
<message>
<source>Click here to apply changes any you have made.</source>
<translation>Hier klicken um Änderungen zu
übernehmen.</translation>
</message>
<message>
<source>User deleted successfully</source>
<translation>Benutzer erfolgreich gelöscht</translation>
</message>
<message>
<source>&Delete User</source>
<translation>&Benutzer löschen</translation>
</message>
<message>
<source>User created successfully.</source>
<translation>Benutzer erfolgreich angelegt.</translation>
</message>
<message>
<source>User modified successfully.</source>
<translation>Benutzer erfolgreich modifiziert.</translation>
</message>
<message>
<source>&Apply</source>
<translation>Ü&bernehmen</translation>
</message>
<message>
<source>&Add</source>
<translation>&Hinzufügen</translation>
</message>
<message>
<source>&Close</source>
<translation>&Schließen</translation>
</message>
<message>
<source>An error occured while applying the Grants.</source>
<translation>Beim Anwenden der Rechte ist ein Fehler
aufgetreten.</translation>
</message>
<message>
<source>Confirm Delete User</source>
<translation>Benutzer löschen bestätigen</translation>
</message>
<message>
<source>Are you sure you want to Delete User</source>
<translation>Sind Sie sicher, dass Sie den Benutzer löschen
wollen?</translation>
</message>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>This is the Hostname the Username will be connecting from. Use '%' for referring to Any.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This option will grant Username privileges for GRANT.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the Username you will be Granting / Editing privileges to.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Close this Dialog without saving any changes you have made.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>These are the Databases/Tables username will have access to.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>An error occurred while refreshing the databases or tables.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CUserItem</name>
<message>
<source>Edit User only works for mysql >= 3.23</source>
<translation>Benutzer bearbeiten funktioniert erst ab mysql >=
3.23</translation>
</message>
<message>
<source>&Edit User</source>
<translation>B&enutzer bearbeiten</translation>
</message>
<message>
<source>&Delete User</source>
<translation>Benutzer &löschen</translation>
</message>
<message>
<source>&New User</source>
<translation>&Neuer Benutzer</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<source>&Yes</source>
<translation>&Ja</translation>
</message>
<message>
<source>&No</source>
<translation>&Nein</translation>
</message>
<message>
<source>All Files</source>
<translation>Alle Dateien</translation>
</message>
<message>
<source>Successfully Renamed Table</source>
<translation>Tabelle erfolgreich umbenannt</translation>
</message>
<message>
<source>Confirm Delete Table</source>
<translation>Tabelle löschen bestätigen</translation>
</message>
<message>
<source>Are you sure you want to Delete Table</source>
<translation>Sind Sie sicher, dass Sie diese Tabelle löschen
wollen?</translation>
</message>
<message>
<source>Successfully Deleted Table</source>
<translation>Tabelle erfolgreich gelöscht</translation>
</message>
<message>
<source>Confirm Empty Table</source>
<translation>Tabelle leeren bestätigen</translation>
</message>
<message>
<source>Are you sure you want to Empty Table</source>
<translation>Sind Sie sicher, dass Sie die Tabelle leeren
wollen?</translation>
</message>
<message>
<source>Successfully Emptied Table</source>
<translation>Tabelle erfolgreich geleert</translation>
</message>
<message>
<source>Number of Rows</source>
<translation>Anzahl Zeilen</translation>
</message>
<message>
<source>Maximum number of Rows to fetch</source>
<translation>Maximale Zahl zu holender Zeilen</translation>
</message>
<message>
<source>Image Files</source>
<translation>Bilddateien</translation>
</message>
<message>
<source>&New User</source>
<translation>&Neuer Benutzer</translation>
</message>
<message>
<source>&Refresh</source>
<translation>&Aktualisieren</translation>
</message>
<message>
<source>The server:</source>
<translation>Der Server:</translation>
</message>
<message>
<source>was not found.</source>
<translation>wurde nicht gefunden.</translation>
</message>
<message>
<source>The database:</source>
<translation>Die Datenbank:</translation>
</message>
<message>
<source>in server:</source>
<translation>auf dem Server:</translation>
</message>
<message>
<source>There is no default connection defined. Create and edit a MySQL Connection and make sure the 'Default' checkbox is checked.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[BIG QUERY] - Query not stored completely in memory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not connect to the server:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Setting 'Max Join Size' to Unlimited in:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SaveToFile</name>
<message>
<source>Replace File</source>
<translation>Datei ersetzen</translation>
</message>
<message>
<source>The specified file name already exists.
Do you want to replace it ?</source>
<translation>Der Dateiname existiert bereits.
Wollen Sie sie ersetzen?</translation>
</message>
</context>
<context>
<name>booltoyesno</name>
<message>
<source>Yes</source>
<translation>Ja</translation>
</message>
<message>
<source>No</source>
<translation>Nein</translation>
</message>
</context>
<context>
<name>nice_time</name>
<message>
<source>days</source>
<translation>Tage</translation>
</message>
<message>
<source>day</source>
<translation>Tag</translation>
</message>
<message>
<source>hours</source>
<translation>Stunden</translation>
</message>
<message>
<source>hour</source>
<translation>Stunde</translation>
</message>
<message>
<source>min</source>
<translation>min</translation>
</message>
<message>
<source>sec</source>
<translation>sec</translation>
</message>
</context>
<context>
<name>saveToFile</name>
<message>
<source>An error occurred while saving the file</source>
<translation>Beim Speichern der Datei ist ein Fehler
aufgetreten</translation>
</message>
<message>
<source>Successfully saved:</source>
<translation>Erfolgreich gespeichert:</translation>
</message>
<message>
<source>Save to File</source>
<translation>In Datei abspeichern</translation>
</message>
</context>
</TS>
| gpl-2.0 |
samuelpenn/mapcraft | worldgen/src/main/java/uk/org/glendale/worldgen/astro/planet/builders/JovianWorld.java | 3495 | /*
* Copyright (C) 2011, 2012 Samuel Penn, sam@glendale.org.uk
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2.
* See the file COPYING.
*/
package uk.org.glendale.worldgen.astro.planet.builders;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import uk.org.glendale.graphics.SimpleImage;
import uk.org.glendale.rpg.utils.Die;
import uk.org.glendale.worldgen.astro.planet.PopulationSize;
import uk.org.glendale.worldgen.astro.planet.TechnologyLevel;
import uk.org.glendale.worldgen.astro.planet.builders.ice.Europan;
import uk.org.glendale.worldgen.astro.planet.maps.Tile;
import uk.org.glendale.worldgen.astro.planet.maps.WorldBuilder;
import uk.org.glendale.worldgen.civ.facility.builders.FacilityBuilder;
/**
* Abstract class for creating Jovian worlds such as Jupiter or Saturn. There
* are several sub types, including EuJovian, SubJovian and CryoJovian. World
* maps are simply the outer cloud layers, no surface maps are generated.
*
* Currently, cloud maps consist of simple stripes with no weather patterns.
*
* @author Samuel Penn
*/
public abstract class JovianWorld extends WorldBuilder {
protected List<Tile> tiles;
public JovianWorld() {
map = new Tile[model.getTotalHeight()][];
for (int y=0; y < model.getTotalHeight(); y++) {
map[y] = new Tile[model.getWidthAtY(y)];
for (int x=0; x < model.getWidthAtY(y); x++) {
map[y][x] = BLANK;
}
}
}
@Override
public void generate() {
tiles = new ArrayList<Tile>();
tiles.add(new Tile("Dark", "#999977", false));
tiles.add(new Tile("Light", "#cccc99", false));
generateMap();
generateResources();
}
protected Tile getBand(int y) {
return tiles.get((y / 2) % tiles.size());
}
private void drawBandedJovianWorld() {
for (int tileY=0; tileY < 12; tileY++) {
map[tileY] = new Tile[model.getWidthAtY(tileY)];
for (int tileX = 0; tileX < model.getWidthAtY(tileY); tileX++) {
map[tileY][tileX] = tiles.get(tileY % tiles.size());
}
}
}
/**
* Add blurring to the cloud bands. This makes the world look a bit more
* natural.
*/
protected SimpleImage postProcess(SimpleImage image) {
BufferedImage bimg = image.getBufferedImage();
int num = Die.d8(4);
for (int i = 0; i < num; i++) {
blur(bimg);
}
return new SimpleImage(bimg);
}
@Override
public void generateMap() {
drawBandedJovianWorld();
getImage();
}
@Override
public void generateResources() {
addResource("Hydrogen", 60 + Die.d20(2));
}
private WorldBuilder[] moonBuilders = null;
/**
* Gets a list of planet types typically found as moons of a Jovian world.
* Jovian worlds can have lots of moons, though generally only the larger
* ones will be listed here. It can be assumed that there will also be a
* large number of captured asteroids.
*/
public WorldBuilder[] getMoonBuilders() {
if (moonBuilders != null) {
return moonBuilders;
}
int numMoons = Die.d3();
System.out.println("JovianWorlds: Adding " + numMoons + " moons");
moonBuilders = new WorldBuilder[numMoons];
for (int i = 0; i < numMoons; i++) {
moonBuilders[i] = new Europan();
}
return moonBuilders;
}
/**
* By default, worlds of this type have no population.
*/
public String getFacilityBuilderName(PopulationSize size, TechnologyLevel level) {
return null;
}
}
| gpl-2.0 |
Jiri-Kremser/euler | 062/Problem.scala | 333 | object Problem {
def main(args: Array[String]) {
val start = System.currentTimeMillis
println(Stream.from(0).map(x => x * x * x.toLong).take(10000).toList.groupBy(_.toString.sorted).filter(_._2.size == 5).map(_._2.head).min)
val stop = System.currentTimeMillis
println("Time taken: " + (stop - start) + "ms")
}
}
| gpl-2.0 |
mviitanen/marsmod | mcp/temp/src/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java | 2311 | package net.minecraft.client.network;
import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.handshake.INetHandlerHandshakeServer;
import net.minecraft.network.handshake.client.C00Handshake;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.NetHandlerLoginServer;
import net.minecraft.util.IChatComponent;
import org.apache.commons.lang3.Validate;
public class NetHandlerHandshakeMemory implements INetHandlerHandshakeServer {
private final MinecraftServer field_147385_a;
private final NetworkManager field_147384_b;
private static final String __OBFID = "CL_00001445";
public NetHandlerHandshakeMemory(MinecraftServer p_i45287_1_, NetworkManager p_i45287_2_) {
this.field_147385_a = p_i45287_1_;
this.field_147384_b = p_i45287_2_;
}
public void func_147383_a(C00Handshake p_147383_1_) {
this.field_147384_b.func_150723_a(p_147383_1_.func_149594_c());
}
public void func_147231_a(IChatComponent p_147231_1_) {}
public void func_147232_a(EnumConnectionState p_147232_1_, EnumConnectionState p_147232_2_) {
Validate.validState(p_147232_2_ == EnumConnectionState.LOGIN || p_147232_2_ == EnumConnectionState.STATUS, "Unexpected protocol " + p_147232_2_, new Object[0]);
switch(NetHandlerHandshakeMemory.SwitchEnumConnectionState.field_151263_a[p_147232_2_.ordinal()]) {
case 1:
this.field_147384_b.func_150719_a(new NetHandlerLoginServer(this.field_147385_a, this.field_147384_b));
case 2:
throw new UnsupportedOperationException("NYI");
default:
}
}
public void func_147233_a() {}
// $FF: synthetic class
static final class SwitchEnumConnectionState {
// $FF: synthetic field
static final int[] field_151263_a = new int[EnumConnectionState.values().length];
private static final String __OBFID = "CL_00001446";
static {
try {
field_151263_a[EnumConnectionState.LOGIN.ordinal()] = 1;
} catch (NoSuchFieldError var2) {
;
}
try {
field_151263_a[EnumConnectionState.STATUS.ordinal()] = 2;
} catch (NoSuchFieldError var1) {
;
}
}
}
}
| gpl-2.0 |
benjaminug/osgeo-drupal | sites/default/themes/osgeo/node.tpl.php | 787 | <div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<?php print $user_picture; ?>
<?php print render($title_prefix); ?>
<?php if (!$page): ?>
<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<?php if ($submitted): ?>
<span class="submitted"><?php print $submitted; ?></span>
<?php endif; ?>
<div class="content">
<?php print render($content); ?>
</div>
<div class="meta">
<?php //if ($terms): ?>
<div class="terms"><?php print render($content['terms']); ?></div>
<?php //endif;?>
</div>
<?php if ($links): ?>
<div class="links"><?php print render($links); ?></div>
<?php endif; ?>
</div>
| gpl-2.0 |
bozokyzoltan/Disordered_conformers | extract_structure.py | 1637 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by Zoltan Bozoky on 2014.09.08.
Under GPL licence.
Purpose:
========
* Extract certain PDBs out of the STR file
"""
import sys
import os
from disconf import fileio
from disconf import path
def save_one_pdb_file(NAME, folders, extentions, conformernumber):
"""
"""
file_number, position = path.which_number(int(conformernumber))
str_filename = ''.join((folders['structure'],
NAME,
'_',
str(file_number),
extentions['structure']
))
if not os.path.exists(folders['pdb']):
os.makedirs(folders['pdb'])
pdb_filename = ''.join((folders['pdb'],
NAME,
'_',
str(conformernumber),
extentions['pdb']
))
fileio.write_pdb_file(str_filename, position, pdb_filename)
return None
if len(sys.argv) < 3:
print 'extract_structure.py parameters:'
print '1. < project name > '
print '2. < project path >'
print '+) < conformer number > /at least one number is mandatory'
print 'example: extract_structure.py sic1 /home/sic1 102'
exit()
NAME, PATH = sys.argv[1:3]
STRUCTURES = sys.argv[3:]
folders, extentions = path.get_folders(PATH)
if type(STRUCTURES) == list:
for conformernumber in STRUCTURES:
save_one_pdb_file(NAME, folders, extentions, conformernumber)
else:
save_one_pdb_file(NAME, folders, extentions, STRUCTURES)
| gpl-2.0 |
ryanaustincarlson/camera-adaboost | adaboost/stuff.cpp | 910 | // tests stuff
#include <ctime>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include "WeakClassifier.h"
#include "FeatureVector.h"
#include "TrainingData.h"
#include "circles.h"
using namespace std;
void test_classes();
bool ret_true();
int main(){
srand(time(NULL));
int isTrue = ret_true() ? 1 : -1;
printf("isTrue: %d\n",isTrue);
TrainingData td = create_circle(2,2);
td.printData();
}
bool ret_true(){
return true;
}
void test_classes(){
vector<float> vec;
vec.push_back(2.36);
vec.push_back(5.71);
vec.push_back(4.89);
vector<float> v2;
v2.push_back(1.11);
v2.push_back(3.33);
v2.push_back(5.55);
FeatureVector fv(vec, 1);
//fv.printFeature();
FeatureVector fv2(v2, 2);
TrainingData td;
if (!td.addFeature(fv))
printf("error\n");
if (!td.addFeature(fv2))
printf("error\n");
td.printData();
WeakClassifier wc(3, 0.4, true, 30);
wc.printClassifier();
}
| gpl-2.0 |
tinkershell/drupal | sites/default/files/php/twig/0b421598_image-style.html.twig_deebc85b0cb1a96265a685f92347421987ee3639b5e4bd36f07e93dcd993de0a/2c5422ec68f8366bbd48b76560ecae9ab138e8e9ce0f887c5c4fa81243ba5b61.php | 1562 | <?php
/* core/themes/classy/templates/field/image-style.html.twig */
class __TwigTemplate_0ee0126b076d7f2c7a3253e6e5d66fd2e820aeb2efa62efa7cb53fa851e28fd1 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 18
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["image"]) ? $context["image"] : null), "html", null, true);
echo "
";
}
public function getTemplateName()
{
return "core/themes/classy/templates/field/image-style.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 19 => 18,);
}
}
/* {#*/
/* /***/
/* * @file*/
/* * Theme override for an image using a specific image style.*/
/* **/
/* * Available variables:*/
/* * - attributes: HTML attributes for the image, including the following:*/
/* * - src: Full URL or relative path to the image file.*/
/* * - class: One or more classes to be applied to the image.*/
/* * - width: The width of the image (if known).*/
/* * - height: The height of the image (if known).*/
/* * - title: The title of the image.*/
/* * - alt: The alternative text for the image.*/
/* **/
/* * @see template_preprocess_image_style()*/
/* *//* */
/* #}*/
/* {{ image }}*/
/* */
| gpl-2.0 |
FreeCol/freecol | src/net/sf/freecol/client/gui/ModifierFormat.java | 4830 | /**
* Copyright (C) 2002-2022 The FreeCol Team
*
* This file is part of FreeCol.
*
* FreeCol is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* FreeCol is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FreeCol. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.freecol.client.gui;
import java.text.DecimalFormat;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.swing.JLabel;
import net.sf.freecol.common.i18n.Messages;
import net.sf.freecol.common.model.Feature;
import net.sf.freecol.common.model.FreeColSpecObjectType;
import net.sf.freecol.common.model.FreeColObject;
import net.sf.freecol.common.model.Modifier;
import net.sf.freecol.common.model.Modifier.ModifierType;
import net.sf.freecol.common.model.Nameable;
import net.sf.freecol.common.model.Named;
import net.sf.freecol.common.model.Scope;
import net.sf.freecol.common.model.Turn;
import static net.sf.freecol.common.util.CollectionUtils.*;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
public class ModifierFormat {
/** The decimal format to use for Modifiers. */
private static final DecimalFormat modifierFormat
= new DecimalFormat("0.00");
public static final String getUnknownValue() {
return Messages.message("modifierFormat.unknown");
}
public static final String format(float value) {
return Modifier.isFloatKnown(value) ? modifierFormat.format(value)
: getUnknownValue();
}
private static final String[] getModifierStrings(Modifier modifier) {
return getModifierStrings(modifier.getValue(), modifier.getType());
}
private static final String[] getModifierStrings(float value,
ModifierType type) {
String bonus = modifierFormat.format(value);
if (!Modifier.isFloatKnown(value)) {
return new String[] { " ", bonus, null };
}
String[] result = (value < 0)
? new String[] { "-", bonus.substring(1), null }
: new String[] { "+", bonus, null };
switch (type) {
case MULTIPLICATIVE:
// assumes multiplicative modifiers will never be negative
result[0] = "\u00D7";
break;
case PERCENTAGE:
result[2] = "%";
break;
default:
break;
}
return result;
}
@SuppressFBWarnings(value="NP_LOAD_OF_KNOWN_NULL_VALUE")
private static String getSourceName(FreeColObject source) {
if (source == null) return getUnknownValue();
String result = null;
if (result == null && source instanceof Nameable) {
result = ((Nameable)source).getName();
if (result != null && result.isEmpty()) result = null;
}
if (result == null && source instanceof Named) {
result = Messages.getName((Named)source);
if (result.isEmpty()) result = null;
}
if (result == null) result = Messages.getName(source.getId());
return result;
}
public static JLabel[] getModifierLabels(Modifier modifier,
FreeColSpecObjectType fcgot,
Turn turn) {
String sourceName = getSourceName(modifier.getSource());
if (fcgot != null && modifier.appliesTo(fcgot)) {
sourceName += " (" + Messages.getName(fcgot) + ")";
}
float value = modifier.getValue(turn);
String[] bonus = getModifierStrings(value, modifier.getType());
JLabel[] result = new JLabel[3];
result[0] = new JLabel(sourceName);
result[1] = new JLabel(bonus[0] + bonus[1]);
result[2] = (bonus[2] == null) ? null : new JLabel(bonus[2]);
return result;
}
public static String getFeatureAsString(Feature feature) {
return Messages.getName(feature) + ":"
+ ((!feature.hasScope()) ? ""
: transform(feature.getScopes(), isNotNull(),
Scope::getFeatureString, Collectors.joining(",")));
}
public static String getModifierAsString(Modifier modifier) {
return transform(getModifierStrings(modifier), isNotNull(),
Function.<String>identity(), Collectors.joining());
}
}
| gpl-2.0 |
marlonwang/BookManage | ViewMain/ReaderForm.Designer.cs | 31259 | namespace ViewMain
{
partial class ReaderForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReaderForm));
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsLabRT = new System.Windows.Forms.ToolStripLabel();
this.tsCBoxRT = new System.Windows.Forms.ToolStripComboBox();
this.tsLabRD = new System.Windows.Forms.ToolStripLabel();
this.tsCBoxRD = new System.Windows.Forms.ToolStripComboBox();
this.tsLabRN = new System.Windows.Forms.ToolStripLabel();
this.tsCBoxRN = new System.Windows.Forms.ToolStripTextBox();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.tsBtnFind = new System.Windows.Forms.ToolStripButton();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.tsBtnOutExcel = new System.Windows.Forms.ToolStripButton();
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dgvReader = new System.Windows.Forms.DataGridView();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnExit = new System.Windows.Forms.Button();
this.btnLogout = new System.Windows.Forms.Button();
this.btnFindCard = new System.Windows.Forms.Button();
this.btnLostCard = new System.Windows.Forms.Button();
this.btnModifyCard = new System.Windows.Forms.Button();
this.btnMakeCard = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.btnModifyOk = new System.Windows.Forms.Button();
this.CBoxStatus = new System.Windows.Forms.ComboBox();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.btnCheXiao = new System.Windows.Forms.Button();
this.btnBanZheng = new System.Windows.Forms.Button();
this.btnUploadImg = new System.Windows.Forms.Button();
this.txtBoxMail = new System.Windows.Forms.TextBox();
this.txtBoxTel = new System.Windows.Forms.TextBox();
this.CBoxRD = new System.Windows.Forms.ComboBox();
this.CBoxRT = new System.Windows.Forms.ComboBox();
this.txtBoxRole = new System.Windows.Forms.TextBox();
this.cBoxSex = new System.Windows.Forms.ComboBox();
this.txtBoxLended = new System.Windows.Forms.TextBox();
this.txtBoxPwd = new System.Windows.Forms.TextBox();
this.txtBoxName = new System.Windows.Forms.TextBox();
this.ReaderCardDate = new System.Windows.Forms.Label();
this.ReaderMail = new System.Windows.Forms.Label();
this.ReaderTel = new System.Windows.Forms.Label();
this.ReaderDepart = new System.Windows.Forms.Label();
this.ReaderType = new System.Windows.Forms.Label();
this.ReaderRole = new System.Windows.Forms.Label();
this.ReaderStatus = new System.Windows.Forms.Label();
this.ReaderSex = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.ReaderPwd = new System.Windows.Forms.Label();
this.ReaderName = new System.Windows.Forms.Label();
this.txtBoxID = new System.Windows.Forms.TextBox();
this.ReaderPBox = new System.Windows.Forms.PictureBox();
this.ReaderID = new System.Windows.Forms.Label();
this.toolStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvReader)).BeginInit();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ReaderPBox)).BeginInit();
this.SuspendLayout();
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsLabRT,
this.tsCBoxRT,
this.tsLabRD,
this.tsCBoxRD,
this.tsLabRN,
this.tsCBoxRN,
this.toolStripSeparator1,
this.tsBtnFind,
this.toolStripLabel1,
this.toolStripSeparator2,
this.tsBtnOutExcel,
this.toolStripLabel2});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(763, 25);
this.toolStrip1.TabIndex = 0;
this.toolStrip1.Text = "toolStrip1";
//
// tsLabRT
//
this.tsLabRT.Name = "tsLabRT";
this.tsLabRT.Size = new System.Drawing.Size(65, 22);
this.tsLabRT.Text = "读者类别:";
//
// tsCBoxRT
//
this.tsCBoxRT.Name = "tsCBoxRT";
this.tsCBoxRT.Size = new System.Drawing.Size(121, 25);
//
// tsLabRD
//
this.tsLabRD.Name = "tsLabRD";
this.tsLabRD.Size = new System.Drawing.Size(41, 22);
this.tsLabRD.Text = "单位:";
//
// tsCBoxRD
//
this.tsCBoxRD.Name = "tsCBoxRD";
this.tsCBoxRD.Size = new System.Drawing.Size(121, 25);
//
// tsLabRN
//
this.tsLabRN.Name = "tsLabRN";
this.tsLabRN.Size = new System.Drawing.Size(41, 22);
this.tsLabRN.Text = "姓名:";
//
// tsCBoxRN
//
this.tsCBoxRN.Name = "tsCBoxRN";
this.tsCBoxRN.Size = new System.Drawing.Size(100, 25);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// tsBtnFind
//
this.tsBtnFind.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.tsBtnFind.Image = ((System.Drawing.Image)(resources.GetObject("tsBtnFind.Image")));
this.tsBtnFind.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsBtnFind.Name = "tsBtnFind";
this.tsBtnFind.Size = new System.Drawing.Size(23, 22);
this.tsBtnFind.Text = "查找";
this.tsBtnFind.Click += new System.EventHandler(this.tsBtnFind_Click);
//
// toolStripLabel1
//
this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(29, 22);
this.toolStripLabel1.Text = "查找";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// tsBtnOutExcel
//
this.tsBtnOutExcel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.tsBtnOutExcel.Image = ((System.Drawing.Image)(resources.GetObject("tsBtnOutExcel.Image")));
this.tsBtnOutExcel.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsBtnOutExcel.Name = "tsBtnOutExcel";
this.tsBtnOutExcel.Size = new System.Drawing.Size(23, 22);
this.tsBtnOutExcel.Text = "导出";
this.tsBtnOutExcel.Click += new System.EventHandler(this.tsBtnOutExcel_Click);
//
// toolStripLabel2
//
this.toolStripLabel2.Name = "toolStripLabel2";
this.toolStripLabel2.Size = new System.Drawing.Size(59, 22);
this.toolStripLabel2.Text = "导出Excel";
this.toolStripLabel2.Click += new System.EventHandler(this.toolStripLabel2_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.dgvReader);
this.groupBox1.Location = new System.Drawing.Point(12, 37);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(494, 286);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "查询结果";
//
// dgvReader
//
this.dgvReader.AllowUserToAddRows = false;
this.dgvReader.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvReader.Location = new System.Drawing.Point(5, 17);
this.dgvReader.Name = "dgvReader";
this.dgvReader.RowTemplate.Height = 23;
this.dgvReader.Size = new System.Drawing.Size(483, 263);
this.dgvReader.TabIndex = 0;
this.dgvReader.SelectionChanged += new System.EventHandler(this.dgvReader_SelectionChanged);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.btnExit);
this.groupBox2.Controls.Add(this.btnLogout);
this.groupBox2.Controls.Add(this.btnFindCard);
this.groupBox2.Controls.Add(this.btnLostCard);
this.groupBox2.Controls.Add(this.btnModifyCard);
this.groupBox2.Controls.Add(this.btnMakeCard);
this.groupBox2.Location = new System.Drawing.Point(12, 340);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(494, 57);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "借阅信息";
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(434, 20);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(52, 23);
this.btnExit.TabIndex = 5;
this.btnExit.Text = "退出";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnLogout
//
this.btnLogout.Location = new System.Drawing.Point(371, 20);
this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(52, 23);
this.btnLogout.TabIndex = 4;
this.btnLogout.Text = "注销";
this.btnLogout.UseVisualStyleBackColor = true;
this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
//
// btnFindCard
//
this.btnFindCard.Location = new System.Drawing.Point(236, 21);
this.btnFindCard.Name = "btnFindCard";
this.btnFindCard.Size = new System.Drawing.Size(67, 23);
this.btnFindCard.TabIndex = 3;
this.btnFindCard.Text = "解除挂失";
this.btnFindCard.UseVisualStyleBackColor = true;
this.btnFindCard.Click += new System.EventHandler(this.btnFindCard_Click);
//
// btnLostCard
//
this.btnLostCard.Location = new System.Drawing.Point(172, 21);
this.btnLostCard.Name = "btnLostCard";
this.btnLostCard.Size = new System.Drawing.Size(52, 23);
this.btnLostCard.TabIndex = 2;
this.btnLostCard.Text = "挂失";
this.btnLostCard.UseVisualStyleBackColor = true;
this.btnLostCard.Click += new System.EventHandler(this.btnLostCard_Click);
//
// btnModifyCard
//
this.btnModifyCard.Location = new System.Drawing.Point(89, 21);
this.btnModifyCard.Name = "btnModifyCard";
this.btnModifyCard.Size = new System.Drawing.Size(73, 23);
this.btnModifyCard.TabIndex = 1;
this.btnModifyCard.Text = "变更借书证";
this.btnModifyCard.UseVisualStyleBackColor = true;
this.btnModifyCard.Click += new System.EventHandler(this.btnModifyCard_Click);
//
// btnMakeCard
//
this.btnMakeCard.Location = new System.Drawing.Point(6, 21);
this.btnMakeCard.Name = "btnMakeCard";
this.btnMakeCard.Size = new System.Drawing.Size(73, 23);
this.btnMakeCard.TabIndex = 0;
this.btnMakeCard.Text = "办理借书证";
this.btnMakeCard.UseVisualStyleBackColor = true;
this.btnMakeCard.Click += new System.EventHandler(this.btnMakeCard_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.btnModifyOk);
this.groupBox3.Controls.Add(this.CBoxStatus);
this.groupBox3.Controls.Add(this.dateTimePicker1);
this.groupBox3.Controls.Add(this.btnCheXiao);
this.groupBox3.Controls.Add(this.btnBanZheng);
this.groupBox3.Controls.Add(this.btnUploadImg);
this.groupBox3.Controls.Add(this.txtBoxMail);
this.groupBox3.Controls.Add(this.txtBoxTel);
this.groupBox3.Controls.Add(this.CBoxRD);
this.groupBox3.Controls.Add(this.CBoxRT);
this.groupBox3.Controls.Add(this.txtBoxRole);
this.groupBox3.Controls.Add(this.cBoxSex);
this.groupBox3.Controls.Add(this.txtBoxLended);
this.groupBox3.Controls.Add(this.txtBoxPwd);
this.groupBox3.Controls.Add(this.txtBoxName);
this.groupBox3.Controls.Add(this.ReaderCardDate);
this.groupBox3.Controls.Add(this.ReaderMail);
this.groupBox3.Controls.Add(this.ReaderTel);
this.groupBox3.Controls.Add(this.ReaderDepart);
this.groupBox3.Controls.Add(this.ReaderType);
this.groupBox3.Controls.Add(this.ReaderRole);
this.groupBox3.Controls.Add(this.ReaderStatus);
this.groupBox3.Controls.Add(this.ReaderSex);
this.groupBox3.Controls.Add(this.label1);
this.groupBox3.Controls.Add(this.ReaderPwd);
this.groupBox3.Controls.Add(this.ReaderName);
this.groupBox3.Controls.Add(this.txtBoxID);
this.groupBox3.Controls.Add(this.ReaderPBox);
this.groupBox3.Controls.Add(this.ReaderID);
this.groupBox3.Location = new System.Drawing.Point(512, 37);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(238, 360);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "证件管理";
//
// btnModifyOk
//
this.btnModifyOk.Location = new System.Drawing.Point(83, 332);
this.btnModifyOk.Name = "btnModifyOk";
this.btnModifyOk.Size = new System.Drawing.Size(68, 23);
this.btnModifyOk.TabIndex = 30;
this.btnModifyOk.Text = "确认变更";
this.btnModifyOk.UseVisualStyleBackColor = true;
this.btnModifyOk.Click += new System.EventHandler(this.btnModifyOk_Click);
//
// CBoxStatus
//
this.CBoxStatus.FormattingEnabled = true;
this.CBoxStatus.Items.AddRange(new object[] {
"有效",
"挂失",
"注销"});
this.CBoxStatus.Location = new System.Drawing.Point(68, 153);
this.CBoxStatus.Name = "CBoxStatus";
this.CBoxStatus.Size = new System.Drawing.Size(52, 20);
this.CBoxStatus.TabIndex = 29;
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(68, 305);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(152, 21);
this.dateTimePicker1.TabIndex = 28;
//
// btnCheXiao
//
this.btnCheXiao.Location = new System.Drawing.Point(155, 332);
this.btnCheXiao.Name = "btnCheXiao";
this.btnCheXiao.Size = new System.Drawing.Size(65, 23);
this.btnCheXiao.TabIndex = 27;
this.btnCheXiao.Text = "撤销办证";
this.btnCheXiao.UseVisualStyleBackColor = true;
this.btnCheXiao.Click += new System.EventHandler(this.btnCheXiao_Click);
//
// btnBanZheng
//
this.btnBanZheng.Location = new System.Drawing.Point(12, 332);
this.btnBanZheng.Name = "btnBanZheng";
this.btnBanZheng.Size = new System.Drawing.Size(68, 23);
this.btnBanZheng.TabIndex = 26;
this.btnBanZheng.Text = "确认办证";
this.btnBanZheng.UseVisualStyleBackColor = true;
this.btnBanZheng.Click += new System.EventHandler(this.btnBanZheng_Click);
//
// btnUploadImg
//
this.btnUploadImg.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnUploadImg.Location = new System.Drawing.Point(150, 162);
this.btnUploadImg.Name = "btnUploadImg";
this.btnUploadImg.Size = new System.Drawing.Size(62, 23);
this.btnUploadImg.TabIndex = 25;
this.btnUploadImg.Text = "上传图片";
this.btnUploadImg.UseVisualStyleBackColor = true;
this.btnUploadImg.Click += new System.EventHandler(this.btnUploadImg_Click);
//
// txtBoxMail
//
this.txtBoxMail.Location = new System.Drawing.Point(68, 278);
this.txtBoxMail.Name = "txtBoxMail";
this.txtBoxMail.Size = new System.Drawing.Size(151, 21);
this.txtBoxMail.TabIndex = 23;
//
// txtBoxTel
//
this.txtBoxTel.Location = new System.Drawing.Point(68, 253);
this.txtBoxTel.Name = "txtBoxTel";
this.txtBoxTel.Size = new System.Drawing.Size(151, 21);
this.txtBoxTel.TabIndex = 22;
//
// CBoxRD
//
this.CBoxRD.FormattingEnabled = true;
this.CBoxRD.Location = new System.Drawing.Point(68, 227);
this.CBoxRD.Name = "CBoxRD";
this.CBoxRD.Size = new System.Drawing.Size(152, 20);
this.CBoxRD.TabIndex = 21;
//
// CBoxRT
//
this.CBoxRT.FormattingEnabled = true;
this.CBoxRT.Location = new System.Drawing.Point(68, 201);
this.CBoxRT.Name = "CBoxRT";
this.CBoxRT.Size = new System.Drawing.Size(152, 20);
this.CBoxRT.TabIndex = 20;
//
// txtBoxRole
//
this.txtBoxRole.Location = new System.Drawing.Point(68, 177);
this.txtBoxRole.Name = "txtBoxRole";
this.txtBoxRole.Size = new System.Drawing.Size(52, 21);
this.txtBoxRole.TabIndex = 19;
//
// cBoxSex
//
this.cBoxSex.FormattingEnabled = true;
this.cBoxSex.Items.AddRange(new object[] {
"男",
"女"});
this.cBoxSex.Location = new System.Drawing.Point(45, 104);
this.cBoxSex.Name = "cBoxSex";
this.cBoxSex.Size = new System.Drawing.Size(60, 20);
this.cBoxSex.TabIndex = 17;
//
// txtBoxLended
//
this.txtBoxLended.Location = new System.Drawing.Point(45, 129);
this.txtBoxLended.Name = "txtBoxLended";
this.txtBoxLended.Size = new System.Drawing.Size(60, 21);
this.txtBoxLended.TabIndex = 16;
//
// txtBoxPwd
//
this.txtBoxPwd.Location = new System.Drawing.Point(45, 77);
this.txtBoxPwd.Name = "txtBoxPwd";
this.txtBoxPwd.PasswordChar = '*';
this.txtBoxPwd.Size = new System.Drawing.Size(60, 21);
this.txtBoxPwd.TabIndex = 15;
//
// txtBoxName
//
this.txtBoxName.Location = new System.Drawing.Point(45, 50);
this.txtBoxName.Name = "txtBoxName";
this.txtBoxName.Size = new System.Drawing.Size(60, 21);
this.txtBoxName.TabIndex = 14;
//
// ReaderCardDate
//
this.ReaderCardDate.AutoSize = true;
this.ReaderCardDate.Location = new System.Drawing.Point(10, 308);
this.ReaderCardDate.Name = "ReaderCardDate";
this.ReaderCardDate.Size = new System.Drawing.Size(53, 12);
this.ReaderCardDate.TabIndex = 13;
this.ReaderCardDate.Text = "办证日期";
//
// ReaderMail
//
this.ReaderMail.AutoSize = true;
this.ReaderMail.Location = new System.Drawing.Point(9, 283);
this.ReaderMail.Name = "ReaderMail";
this.ReaderMail.Size = new System.Drawing.Size(53, 12);
this.ReaderMail.TabIndex = 12;
this.ReaderMail.Text = "电子邮件";
//
// ReaderTel
//
this.ReaderTel.AutoSize = true;
this.ReaderTel.Location = new System.Drawing.Point(9, 256);
this.ReaderTel.Name = "ReaderTel";
this.ReaderTel.Size = new System.Drawing.Size(53, 12);
this.ReaderTel.TabIndex = 11;
this.ReaderTel.Text = "电话号码";
//
// ReaderDepart
//
this.ReaderDepart.AutoSize = true;
this.ReaderDepart.Location = new System.Drawing.Point(10, 232);
this.ReaderDepart.Name = "ReaderDepart";
this.ReaderDepart.Size = new System.Drawing.Size(53, 12);
this.ReaderDepart.TabIndex = 10;
this.ReaderDepart.Text = "所在单位";
//
// ReaderType
//
this.ReaderType.AutoSize = true;
this.ReaderType.Location = new System.Drawing.Point(8, 205);
this.ReaderType.Name = "ReaderType";
this.ReaderType.Size = new System.Drawing.Size(53, 12);
this.ReaderType.TabIndex = 9;
this.ReaderType.Text = "读者类别";
//
// ReaderRole
//
this.ReaderRole.AutoSize = true;
this.ReaderRole.Location = new System.Drawing.Point(8, 182);
this.ReaderRole.Name = "ReaderRole";
this.ReaderRole.Size = new System.Drawing.Size(53, 12);
this.ReaderRole.TabIndex = 8;
this.ReaderRole.Text = "读者角色";
//
// ReaderStatus
//
this.ReaderStatus.AutoSize = true;
this.ReaderStatus.Location = new System.Drawing.Point(8, 159);
this.ReaderStatus.Name = "ReaderStatus";
this.ReaderStatus.Size = new System.Drawing.Size(53, 12);
this.ReaderStatus.TabIndex = 7;
this.ReaderStatus.Text = "证件状态";
//
// ReaderSex
//
this.ReaderSex.AutoSize = true;
this.ReaderSex.Location = new System.Drawing.Point(8, 134);
this.ReaderSex.Name = "ReaderSex";
this.ReaderSex.Size = new System.Drawing.Size(29, 12);
this.ReaderSex.TabIndex = 6;
this.ReaderSex.Text = "已借";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 107);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 5;
this.label1.Text = "性别";
//
// ReaderPwd
//
this.ReaderPwd.AutoSize = true;
this.ReaderPwd.Location = new System.Drawing.Point(7, 81);
this.ReaderPwd.Name = "ReaderPwd";
this.ReaderPwd.Size = new System.Drawing.Size(29, 12);
this.ReaderPwd.TabIndex = 4;
this.ReaderPwd.Text = "密码";
//
// ReaderName
//
this.ReaderName.AutoSize = true;
this.ReaderName.Location = new System.Drawing.Point(7, 53);
this.ReaderName.Name = "ReaderName";
this.ReaderName.Size = new System.Drawing.Size(29, 12);
this.ReaderName.TabIndex = 3;
this.ReaderName.Text = "姓名";
//
// txtBoxID
//
this.txtBoxID.Location = new System.Drawing.Point(45, 23);
this.txtBoxID.Name = "txtBoxID";
this.txtBoxID.Size = new System.Drawing.Size(60, 21);
this.txtBoxID.TabIndex = 2;
//
// ReaderPBox
//
this.ReaderPBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ReaderPBox.Image = global::ViewMain.Properties.Resources._default;
this.ReaderPBox.Location = new System.Drawing.Point(120, 21);
this.ReaderPBox.Name = "ReaderPBox";
this.ReaderPBox.Size = new System.Drawing.Size(112, 126);
this.ReaderPBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.ReaderPBox.TabIndex = 1;
this.ReaderPBox.TabStop = false;
//
// ReaderID
//
this.ReaderID.AutoSize = true;
this.ReaderID.Location = new System.Drawing.Point(6, 28);
this.ReaderID.Name = "ReaderID";
this.ReaderID.Size = new System.Drawing.Size(29, 12);
this.ReaderID.TabIndex = 0;
this.ReaderID.Text = "证号";
//
// ReaderForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(763, 409);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.toolStrip1);
this.Name = "ReaderForm";
this.Text = "图书证管理";
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvReader)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.ReaderPBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripLabel tsLabRT;
private System.Windows.Forms.ToolStripComboBox tsCBoxRT;
private System.Windows.Forms.ToolStripLabel tsLabRD;
private System.Windows.Forms.ToolStripComboBox tsCBoxRD;
private System.Windows.Forms.ToolStripLabel tsLabRN;
private System.Windows.Forms.ToolStripTextBox tsCBoxRN;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton tsBtnFind;
private System.Windows.Forms.ToolStripButton tsBtnOutExcel;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Button btnLogout;
private System.Windows.Forms.Button btnFindCard;
private System.Windows.Forms.Button btnLostCard;
private System.Windows.Forms.Button btnModifyCard;
private System.Windows.Forms.Button btnMakeCard;
private System.Windows.Forms.DataGridView dgvReader;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.PictureBox ReaderPBox;
private System.Windows.Forms.Label ReaderID;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label ReaderPwd;
private System.Windows.Forms.Label ReaderName;
private System.Windows.Forms.TextBox txtBoxID;
private System.Windows.Forms.Label ReaderTel;
private System.Windows.Forms.Label ReaderDepart;
private System.Windows.Forms.Label ReaderType;
private System.Windows.Forms.Label ReaderRole;
private System.Windows.Forms.Label ReaderStatus;
private System.Windows.Forms.Label ReaderSex;
private System.Windows.Forms.ComboBox cBoxSex;
private System.Windows.Forms.TextBox txtBoxLended;
private System.Windows.Forms.TextBox txtBoxPwd;
private System.Windows.Forms.TextBox txtBoxName;
private System.Windows.Forms.Label ReaderCardDate;
private System.Windows.Forms.Label ReaderMail;
private System.Windows.Forms.TextBox txtBoxMail;
private System.Windows.Forms.TextBox txtBoxTel;
private System.Windows.Forms.ComboBox CBoxRD;
private System.Windows.Forms.ComboBox CBoxRT;
private System.Windows.Forms.TextBox txtBoxRole;
private System.Windows.Forms.Button btnUploadImg;
private System.Windows.Forms.Button btnCheXiao;
private System.Windows.Forms.Button btnBanZheng;
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
private System.Windows.Forms.ToolStripLabel toolStripLabel2;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.ComboBox CBoxStatus;
private System.Windows.Forms.Button btnModifyOk;
}
} | gpl-2.0 |
colloquium/spacewalk | java/code/src/com/redhat/rhn/domain/monitoring/notification/NotificationFactory.java | 8389 | /**
* Copyright (c) 2009--2010 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public License,
* version 2 (GPLv2). There is NO WARRANTY for this software, express or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
* along with this software; if not, see
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
* Red Hat trademarks are not licensed under GPLv2. No permission is
* granted to use or replicate Red Hat trademarks that are incorporated
* in this software or its documentation.
*/
package com.redhat.rhn.domain.monitoring.notification;
import com.redhat.rhn.common.hibernate.HibernateFactory;
import com.redhat.rhn.common.hibernate.HibernateRuntimeException;
import com.redhat.rhn.domain.user.User;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* NotificationFactory - the singleton class used to fetch and store
* com.redhat.rhn.domain.monitoring.notification.* objects from the
* database.
* @version $Rev: 51602 $
*/
public class NotificationFactory extends HibernateFactory {
public static final FilterType FILTER_TYPE_REDIR = lookupFilterType("REDIR");
public static final FilterType FILTER_TYPE_ACK = lookupFilterType("ACK");
public static final FilterType FILTER_TYPE_BLACKHOLE = lookupFilterType("BLACKHOLE");
public static final FilterType FILTER_TYPE_METOO = lookupFilterType("METOO");
private static final List FILTER_TYPES;
static {
List types = new ArrayList();
types.add(FILTER_TYPE_REDIR);
types.add(FILTER_TYPE_ACK);
types.add(FILTER_TYPE_BLACKHOLE);
types.add(FILTER_TYPE_METOO);
FILTER_TYPES = Collections.unmodifiableList(types);
}
/** Default Format class for Notification Methods */
public static final Format FORMAT_DEFAULT = lookupFormat(new Long(4));
public static final MethodType TYPE_PAGER = lookupMethodType(new Long(1));
public static final MethodType TYPE_EMAIL = lookupMethodType(new Long(2));
public static final MethodType TYPE_GROUP = lookupMethodType(new Long(4));
public static final MethodType TYPE_SNMP = lookupMethodType(new Long(5));
private static NotificationFactory singleton = new NotificationFactory();
private static Logger log = Logger.getLogger(NotificationFactory.class);
private NotificationFactory() {
super();
}
/**
* Get the Logger for the derived class so log messages
* show up on the correct class
*/
protected Logger getLogger() {
return log;
}
/**
* Create a new ContactGroup. Sets up proper defaults.
* @param creator who owns this group
* @return ContactGroup created
*/
public static ContactGroup createContactGroup(User creator) {
ContactGroup cg = new ContactGroup();
cg.setAckWait(new Long(0));
cg.setCustomerId(creator.getOrg().getId());
cg.setStrategyId(new Long(1));
cg.setNotificationFormatId(NotificationFactory.TYPE_GROUP.getId());
cg.setRotateFirst("0");
cg.setStrategyId(new Long(1));
return cg;
}
/**
* Store a notification Filter
*
* @param filterIn Filter to save.
* @param currentUser who is saving the Filter
*/
public static void saveFilter(Filter filterIn, User currentUser) {
filterIn.setLastUpdateDate(new Date());
filterIn.setLastUpdateUser(currentUser.getLogin());
singleton.saveObject(filterIn);
}
/**
* Lookup a Filter
* @param id of the Filter
* @param currentUser who wants to lookup
* @return Filter if found, null if not
*/
public static Filter lookupFilter(Long id, User currentUser) {
Map params = new HashMap();
params.put("fid", id);
params.put("orgId", currentUser.getOrg().getId());
return (Filter) singleton.lookupObjectByNamedQuery(
"Filter.findByIdandOrgId", params);
}
/**
* Return a list of all filter typ insert="false" update="falsees
* @return a list of all filter types
*/
public static List listFilterTypes() {
return FILTER_TYPES;
}
/**
* Return the filter type with the given name
* @param type the name of the filter type
* @return the filter type with the given name
*/
public static FilterType lookupFilterType(String type) {
FilterType retval = null;
try {
retval = (FilterType) getSession().get(FilterType.class, type);
}
catch (HibernateException e) {
throw new
HibernateRuntimeException("Exception looking up FilterType: " + e, e);
}
return retval;
}
/**
* Lookup a Format.
* @param idIn of the Format
* @return Format found
*/
private static Format lookupFormat(Long idIn) {
Format retval = null;
try {
retval = (Format) getSession().get(Format.class, idIn);
}
catch (HibernateException e) {
throw new
HibernateRuntimeException("Exception looking up Format: " + e, e);
}
return retval;
}
/**
* Lookup a Format.
* @param idIn of the Format
* @return Format found
*/
private static MethodType lookupMethodType(Long idIn) {
MethodType retval = null;
try {
retval = (MethodType) getSession().get(MethodType.class, idIn);
}
catch (HibernateException e) {
throw new
HibernateRuntimeException("Exception looking up MethodType: " + e, e);
}
return retval;
}
/**
* Store a notification Method
*
* @param methodIn Method to save.
* @param currentUser who is saving the Method
*/
public static void saveMethod(Method methodIn, User currentUser) {
methodIn.setLastUpdateDate(new Date());
methodIn.setLastUpdateUser(currentUser.getLogin());
singleton.saveObject(methodIn);
}
/**
* Lookup a Notification Method from the db.
* @param methodId we want to lookup
* @param currentUser Current user doing the lookup.
* @return Method if found.
*/
public static Method lookupMethod(Long methodId, User currentUser) {
Method retval = null;
try {
retval = (Method) getSession().get(Method.class, methodId);
}
catch (HibernateException e) {
throw new
HibernateRuntimeException("Exception looking up Method: " + e, e);
}
// Security check since the
if (retval != null && retval.getUser().getOrg().equals(currentUser.getOrg())) {
return retval;
}
else {
return null;
}
}
/**
* Lookup a Method by methodName and userId
* @param methodName of the Method
* @param userId of the User who owns the method
* @return Method if found.
*/
public static Method lookupMethodByNameAndUser(String methodName, Long userId) {
Map params = new HashMap();
params.put("name", methodName);
params.put("userId", userId);
return (Method) singleton.lookupObjectByNamedQuery(
"Method.findByNameAndUserId", params);
}
/**
* Save a ContactGroup
* @param userIn who is saving the ContactGroup
* @param cg to save
*/
public static void saveContactGroup(User userIn, ContactGroup cg) {
cg.setLastUpdateDate(new Date());
cg.setLastUpdateUser(userIn.getLogin());
singleton.saveObject(cg);
}
/**
* Lookup a ContactGroup by name
* @param methodName to lookup
* @return ContactGroup found. Null if not
*/
public static ContactGroup lookupContactGroupByName(String methodName) {
Map params = new HashMap();
params.put("name", methodName);
return (ContactGroup) singleton.lookupObjectByNamedQuery(
"ContactGroup.findByName", params);
}
}
| gpl-2.0 |
aishangzoulu/raylew_searchengine_server | com-searchengine-preprocess/src/main/java/com/searchengine/preprocess/alpha/util/MD5.java | 10576 | package com.searchengine.preprocess.alpha.util;
import java.lang.reflect. * ;
public class MD5 {
static final int S11 = 7 ;
static final int S12 = 12 ;
static final int S13 = 17 ;
static final int S14 = 22 ;
static final int S21 = 5 ;
static final int S22 = 9 ;
static final int S23 = 14 ;
static final int S24 = 20 ;
static final int S31 = 4 ;
static final int S32 = 11 ;
static final int S33 = 16 ;
static final int S34 = 23 ;
static final int S41 = 6 ;
static final int S42 = 10 ;
static final int S43 = 15 ;
static final int S44 = 21 ;
static final byte [] PADDING = { - 128 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ;
private long [] state = new long [ 4 ]; // state (ABCD)
private long [] count = new long [ 2 ]; // number of bits, modulo 2^64 (lsb first)
private byte [] buffer = new byte [ 64 ]; // input buffer
public String digestHexStr;
private byte [] digest = new byte [ 16 ];
public String getMD5ofStr(String inbuf) {
md5Init();
md5Update(inbuf.getBytes(), inbuf.length());
md5Final();
digestHexStr = "" ;
for ( int i = 0 ; i < 16 ; i ++ ) {
digestHexStr += byteHEX(digest[i]);
}
return digestHexStr;
}
public MD5() {
md5Init();
return ;
}
private void md5Init() {
count[ 0 ] = 0L ;
count[ 1 ] = 0L ;
// /* Load magic initialization constants.
state[ 0 ] = 0x67452301L ;
state[ 1 ] = 0xefcdab89L ;
state[ 2 ] = 0x98badcfeL ;
state[ 3 ] = 0x10325476L ;
return ;
}
private long F( long x, long y, long z) {
return (x & y) | (( ~ x) & z);
}
private long G( long x, long y, long z) {
return (x & z) | (y & ( ~ z));
}
private long H( long x, long y, long z) {
return x ^ y ^ z;
}
private long I( long x, long y, long z) {
return y ^ (x | ( ~ z));
}
private long FF( long a, long b, long c, long d, long x, long s, long ac) {
a += F (b, c, d) + x + ac;
a = (( int ) a << s) | (( int ) a >>> ( 32 - s));
a += b;
return a;
}
private long GG( long a, long b, long c, long d, long x, long s, long ac) {
a += G (b, c, d) + x + ac;
a = (( int ) a << s) | (( int ) a >>> ( 32 - s));
a += b;
return a;
}
private long HH( long a, long b, long c, long d, long x, long s, long ac) {
a += H (b, c, d) + x + ac;
a = (( int ) a << s) | (( int ) a >>> ( 32 - s));
a += b;
return a;
}
private long II( long a, long b, long c, long d, long x, long s, long ac) {
a += I (b, c, d) + x + ac;
a = (( int ) a << s) | (( int ) a >>> ( 32 - s));
a += b;
return a;
}
private void md5Update(byte[] inbuf, int inputLen) {
int i, index, partLen;
byte[] block = new byte[64];
index = (int) (count[0] >>> 3) & 0x3F;
// /* Update number of bits */
if ((count[0] += (inputLen << 3)) < (inputLen << 3))
count[1]++;
count[1] += (inputLen >>> 29);
partLen = 64 - index;
// Transform as many times as possible.
if (inputLen >= partLen) {
md5Memcpy(buffer, inbuf, index, 0, partLen);
md5Transform(buffer);
for (i = partLen; i + 63 < inputLen; i += 64) {
md5Memcpy(block, inbuf, 0, i, 64);
md5Transform(block);
}
index = 0;
} else
i = 0;
// /* Buffer remaining input */
md5Memcpy(buffer, inbuf, index, i, inputLen - i);
}
private void md5Final() {
byte[] bits = new byte[8];
int index, padLen;
// /* Save number of bits */
Encode(bits, count, 8);
// /* Pad out to 56 mod 64.
index = (int) (count[0] >>> 3) & 0x3f;
padLen = (index < 56) ? (56 - index) : (120 - index);
md5Update(PADDING, padLen);
// /* Append length (before padding) */
md5Update(bits, 8);
// /* Store state in digest */
Encode(digest, state, 16);
}
private void md5Memcpy(byte[] output, byte[] input, int outpos, int inpos, int len) {
int i;
for (i = 0; i < len; i++)
output[outpos + i] = input[inpos + i];
}
private void md5Transform(byte block[]) {
long a = state[0], b = state[1], c = state[2], d = state[3];
long[] x = new long[16];
Decode(x, block, 64);
/*Round 1 */
a = FF(a, b, c, d, x[0], S11, 0xd76aa478L); /**//* 1 */
d = FF(d, a, b, c, x[1], S12, 0xe8c7b756L); /**//* 2 */
c = FF(c, d, a, b, x[2], S13, 0x242070dbL); /**//* 3 */
b = FF(b, c, d, a, x[3], S14, 0xc1bdceeeL); /**//* 4 */
a = FF(a, b, c, d, x[4], S11, 0xf57c0fafL); /**//* 5 */
d = FF(d, a, b, c, x[5], S12, 0x4787c62aL); /**//* 6 */
c = FF(c, d, a, b, x[6], S13, 0xa8304613L); /**//* 7 */
b = FF(b, c, d, a, x[7], S14, 0xfd469501L); /**//* 8 */
a = FF(a, b, c, d, x[8], S11, 0x698098d8L); /**//* 9 */
d = FF(d, a, b, c, x[9], S12, 0x8b44f7afL); /**//* 10 */
c = FF(c, d, a, b, x[10], S13, 0xffff5bb1L); /**//* 11 */
b = FF(b, c, d, a, x[11], S14, 0x895cd7beL); /**//* 12 */
a = FF(a, b, c, d, x[12], S11, 0x6b901122L); /**//* 13 */
d = FF(d, a, b, c, x[13], S12, 0xfd987193L); /**//* 14 */
c = FF(c, d, a, b, x[14], S13, 0xa679438eL); /**//* 15 */
b = FF(b, c, d, a, x[15], S14, 0x49b40821L); /**//* 16 */
/* Round 2 */
a = GG(a, b, c, d, x[1], S21, 0xf61e2562L); /**//* 17 */
d = GG(d, a, b, c, x[6], S22, 0xc040b340L); /**//* 18 */
c = GG(c, d, a, b, x[11], S23, 0x265e5a51L); /**//* 19 */
b = GG(b, c, d, a, x[0], S24, 0xe9b6c7aaL); /**//* 20 */
a = GG(a, b, c, d, x[5], S21, 0xd62f105dL); /**//* 21 */
d = GG(d, a, b, c, x[10], S22, 0x2441453L); /**//* 22 */
c = GG(c, d, a, b, x[15], S23, 0xd8a1e681L); /**//* 23 */
b = GG(b, c, d, a, x[4], S24, 0xe7d3fbc8L); /**//* 24 */
a = GG(a, b, c, d, x[9], S21, 0x21e1cde6L); /**//* 25 */
d = GG(d, a, b, c, x[14], S22, 0xc33707d6L); /**//* 26 */
c = GG(c, d, a, b, x[3], S23, 0xf4d50d87L); /**//* 27 */
b = GG(b, c, d, a, x[8], S24, 0x455a14edL); /**//* 28 */
a = GG(a, b, c, d, x[13], S21, 0xa9e3e905L); /**//* 29 */
d = GG(d, a, b, c, x[2], S22, 0xfcefa3f8L); /**//* 30 */
c = GG(c, d, a, b, x[7], S23, 0x676f02d9L); /**//* 31 */
b = GG(b, c, d, a, x[12], S24, 0x8d2a4c8aL); /**//* 32 */
/*Round 3 */
a = HH(a, b, c, d, x[5], S31, 0xfffa3942L); /**//* 33 */
d = HH(d, a, b, c, x[8], S32, 0x8771f681L); /**//* 34 */
c = HH(c, d, a, b, x[11], S33, 0x6d9d6122L); /**//* 35 */
b = HH(b, c, d, a, x[14], S34, 0xfde5380cL); /**//* 36 */
a = HH(a, b, c, d, x[1], S31, 0xa4beea44L); /**//* 37 */
d = HH(d, a, b, c, x[4], S32, 0x4bdecfa9L); /**//* 38 */
c = HH(c, d, a, b, x[7], S33, 0xf6bb4b60L); /**//* 39 */
b = HH(b, c, d, a, x[10], S34, 0xbebfbc70L); /**//* 40 */
a = HH(a, b, c, d, x[13], S31, 0x289b7ec6L); /**//* 41 */
d = HH(d, a, b, c, x[0], S32, 0xeaa127faL); /**//* 42 */
c = HH(c, d, a, b, x[3], S33, 0xd4ef3085L); /**//* 43 */
b = HH(b, c, d, a, x[6], S34, 0x4881d05L); /**//* 44 */
a = HH(a, b, c, d, x[9], S31, 0xd9d4d039L); /**//* 45 */
d = HH(d, a, b, c, x[12], S32, 0xe6db99e5L); /**//* 46 */
c = HH(c, d, a, b, x[15], S33, 0x1fa27cf8L); /**//* 47 */
b = HH(b, c, d, a, x[2], S34, 0xc4ac5665L); /**//* 48 */
/* Round 4 */
a = II(a, b, c, d, x[0], S41, 0xf4292244L); /**//* 49 */
d = II(d, a, b, c, x[7], S42, 0x432aff97L); /**//* 50 */
c = II(c, d, a, b, x[14], S43, 0xab9423a7L); /**//* 51 */
b = II(b, c, d, a, x[5], S44, 0xfc93a039L); /**//* 52 */
a = II(a, b, c, d, x[12], S41, 0x655b59c3L); /**//* 53 */
d = II(d, a, b, c, x[3], S42, 0x8f0ccc92L); /**//* 54 */
c = II(c, d, a, b, x[10], S43, 0xffeff47dL); /**//* 55 */
b = II(b, c, d, a, x[1], S44, 0x85845dd1L); /**//* 56 */
a = II(a, b, c, d, x[8], S41, 0x6fa87e4fL); /**//* 57 */
d = II(d, a, b, c, x[15], S42, 0xfe2ce6e0L); /**//* 58 */
c = II(c, d, a, b, x[6], S43, 0xa3014314L); /**//* 59 */
b = II(b, c, d, a, x[13], S44, 0x4e0811a1L); /**//* 60 */
a = II(a, b, c, d, x[4], S41, 0xf7537e82L); /**//* 61 */
d = II(d, a, b, c, x[11], S42, 0xbd3af235L); /**//* 62 */
c = II(c, d, a, b, x[2], S43, 0x2ad7d2bbL); /**//* 63 */
b = II(b, c, d, a, x[9], S44, 0xeb86d391L); /**//* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
}
private void Encode(byte[] output, long[] input, int len) {
int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (byte) (input[i] & 0xffL);
output[j + 1] = (byte) ((input[i] >>> 8) & 0xffL);
output[j + 2] = (byte) ((input[i] >>> 16) & 0xffL);
output[j + 3] = (byte) ((input[i] >>> 24) & 0xffL);
}
}
private void Decode(long[] output, byte[] input, int len) {
int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = b2iu(input[j]) | (b2iu(input[j + 1]) << 8)
| (b2iu(input[j + 2]) << 16) | (b2iu(input[j + 3]) << 24);
return;
}
public static long b2iu(byte b) {
return b < 0 ? b & 0x7F + 128 : b;
}
public static String byteHEX( byte ib) {
char[] Digit = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' } ;
char [] ob = new char [ 2 ];
ob[ 0 ] = Digit[(ib >>> 4 ) & 0X0F ];
ob[ 1 ] = Digit[ib & 0X0F ];
String s = new String(ob);
return s;
}
public static void main(String args[]) {
MD5 m = new MD5();
if (Array.getLength(args) == 0 ) {
System.out.println( " MD5 Test suite: " );
System.out.println( " MD5(\" \" ): " + m.getMD5ofStr( "" ));
System.out.println( " MD5(\" a \" ): " + m.getMD5ofStr( "a" ));
System.out.println( " MD5(\" abc \" ): " + m.getMD5ofStr( "abc" ));
System.out.println( " MD5(\" message digest \" ): " + m.getMD5ofStr( "message digest" ));
System.out.println( " MD5(\" abcdefghijklmnopqrstuvwxyz \" ): " +
m.getMD5ofStr( "abcdefghijklmnopqrstuvwxyz" ));
System.out.println( " MD5(\" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 \" ): " +
m.getMD5ofStr( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ));
}
else
System.out.println( "MD5( " + args[0] + " )= " + m.getMD5ofStr(args[0]));
}
} | gpl-2.0 |
j5shi/Thruster | pylibs/test/test_normalization.py | 3233 | from test.test_support import run_unittest, open_urlresource
import unittest
from httplib import HTTPException
import sys
import os
from unicodedata import normalize, unidata_version
TESTDATAFILE = "NormalizationTest.txt"
TESTDATAURL = "http://www.unicode.org/Public/" + unidata_version + "/ucd/" + TESTDATAFILE
def check_version(testfile):
hdr = testfile.readline()
return unidata_version in hdr
class RangeError(Exception):
pass
def NFC(str):
return normalize("NFC", str)
def NFKC(str):
return normalize("NFKC", str)
def NFD(str):
return normalize("NFD", str)
def NFKD(str):
return normalize("NFKD", str)
def unistr(data):
data = [int(x, 16) for x in data.split(" ")]
for x in data:
if x > sys.maxunicode:
raise RangeError
return u"".join([unichr(x) for x in data])
class NormalizationTest(unittest.TestCase):
def test_main(self):
part = None
part1_data = {}
# Hit the exception early
try:
testdata = open_urlresource(TESTDATAURL, check_version)
except (IOError, HTTPException):
self.skipTest("Could not retrieve " + TESTDATAURL)
for line in testdata:
if '#' in line:
line = line.split('#')[0]
line = line.strip()
if not line:
continue
if line.startswith("@Part"):
part = line.split()[0]
continue
try:
c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]]
except RangeError:
# Skip unsupported characters;
# try at least adding c1 if we are in part1
if part == "@Part1":
try:
c1 = unistr(line.split(';')[0])
except RangeError:
pass
else:
part1_data[c1] = 1
continue
# Perform tests
self.assertTrue(c2 == NFC(c1) == NFC(c2) == NFC(c3), line)
self.assertTrue(c4 == NFC(c4) == NFC(c5), line)
self.assertTrue(c3 == NFD(c1) == NFD(c2) == NFD(c3), line)
self.assertTrue(c5 == NFD(c4) == NFD(c5), line)
self.assertTrue(c4 == NFKC(c1) == NFKC(c2) == \
NFKC(c3) == NFKC(c4) == NFKC(c5),
line)
self.assertTrue(c5 == NFKD(c1) == NFKD(c2) == \
NFKD(c3) == NFKD(c4) == NFKD(c5),
line)
# Record part 1 data
if part == "@Part1":
part1_data[c1] = 1
# Perform tests for all other data
for c in range(sys.maxunicode+1):
X = unichr(c)
if X in part1_data:
continue
self.assertTrue(X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c)
def test_bug_834676(self):
# Check for bug 834676
normalize('NFC', u'\ud55c\uae00')
def test_main():
run_unittest(NormalizationTest)
if __name__ == "__main__":
test_main()
| gpl-2.0 |
jcasabona/parsec | page-one-col.php | 606 | <?php
/**
* Template Name: One Column
*
* @package Parsec
*/
get_header(); ?>
<div id="primary" class="content-area one-col">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer(); ?>
| gpl-2.0 |
tyzhaoqi/cartalk | src/com/cartalk/ChartPreferActivity.java | 1118 | package com.cartalk;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.Preference.OnPreferenceChangeListener;
public class ChartPreferActivity extends PreferenceActivity implements
OnPreferenceChangeListener,OnPreferenceClickListener {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.chartpreferences);
PreferenceScreen cmdScr = (PreferenceScreen) getPreferenceScreen()
.findPreference("");
}
public boolean onPreferenceClick(Preference preference) {
// TODO Auto-generated method stub
Intent configIntent = new Intent(this, ChartListActivity.class);
startActivity(configIntent);
return false;
}
public boolean onPreferenceChange(Preference preference, Object newValue) {
// TODO Auto-generated method stub
return false;
}
}
| gpl-2.0 |
adini121/WebDriver | src/main/java/org/sayem/webdriver/basics/webdriver/examples/ScreenshotTests.java | 1252 | package org.sayem.webdriver.basics.webdriver.examples;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.io.File;
public class ScreenshotTests {
WebDriver driver;
@Before
public void setUp() {
driver = new FirefoxDriver();
driver.get("http://www.by_class.com");
}
@Test
public void testTakesScreenshot() {
try {
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("c:\\tmp\\main_page.png"));
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testElementScreenshot() {
WebElement pmoabsdiv = driver.findElement(By.className("pmoabs"));
try {
//FileUtils.copyFile(WebElementExtender.captureElementBitmap(pmoabsdiv), new File("c:\\tmp\\div.png"));
} catch (Exception e) {
e.printStackTrace();
}
}
@After
public void teadDown() {
driver.close();
driver.quit();
}
} | gpl-2.0 |
kosmosby/medicine-prof | administrator/components/com_uddeim/language/vietnamese.php | 107595 | <?php
// *******************************************************************
// Title udde Instant Messages (uddeIM)
// Description Instant Messages System for Mambo 4.5 / Joomla 1.0 / Joomla 1.5
// Author © 2007-2010 Stephan Slabihoud, © 2006 Benjamin Zweifel
// License This is free software and you may redistribute it under the GPL.
// uddeIM comes with absolutely no warranty.
// Use at your own risk. For details, see the license at
// http://www.gnu.org/licenses/gpl.txt
// Other licenses can be found in LICENSES folder.
// *******************************************************************
// Tên component: udde Instant Messages (uddeIM)
// Tác giả: © 2007-2008 Stephan Slabihoud, © 2006 Benjamin Zweifel
// Mô tả: Hệ thống nhắn tin nội bộ cho Joomla 1.0, 1.5, Mambo 4.5 tương thích với Community Builder, JomSocial, Kunena
// Bản quyền: Đây là phần mềm tự do và bạn có thể phân phối lại dưới bản quyền GPL ( http://www.gnu.org/licenses/gpl.txt )
// Bạn tự chịu trách nhiệm về việc sử dụng phần mềm này và chúng tôi không có bất kì đảm bảo nào đối với việc bạn sử dụng nó.
// Ngôn ngữ(Language): Tiếng Việt(Vietnamese)
// Người dịch(Translator): Bùi Quang Vinh<qvsoft@gmail.com>
// Chú ý(Notice): Bản dịch chỉ gồm các thành phần hiển thị tại FrontEnd(For Frontend Only)
// *******************************************************************
DEFINE ('_UDDEADM_TRANSLATORS_CREDITS', 'Translation by <a href="http://www.J4USolutions.com" target="_new">Bùi Quang Vinh</a>'); // Enter your credits line here, e.g. 'Translation by <a href="http://domain.com" target="_new">John Doe</a>'
// New: 3.7
DEFINE ('_UDDEADM_SHOWMENULINK_HEAD', 'Show menu entry');
DEFINE ('_UDDEADM_SHOWMENULINK_EXP', 'Show additional menu entry.');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_16', '...set default for additonal menu link');
// New: 3.6
DEFINE ('_UDDEIM_KUNENA_LINK', 'Forum');
DEFINE ('_UDDEIM_PM_USER', 'Send private message');
DEFINE ('_UDDEIM_PM_USER_DESC', 'Send a private message to this user');
DEFINE ('_UDDEIM_PM_INBOX', 'Show private Inbox');
DEFINE ('_UDDEIM_PM_INBOX_DESC', 'Show received private messages');
DEFINE ('_UDDEIM_PM_OUTBOX', 'Show private Outbox');
DEFINE ('_UDDEIM_PM_OUTBOX_DESC', 'Show sent private messages');
DEFINE ('_UDDEIM_PM_TRASHBOX', 'Show trash');
DEFINE ('_UDDEIM_PM_TRASHBOX_DESC', 'Show trashed private messages');
DEFINE ('_UDDEIM_PM_OPTIONS', 'Show PMS options');
DEFINE ('_UDDEIM_PM_OPTIONS_DESC', 'Show PMS options');
DEFINE ('_UDDEIM_PM_ARCHIVE', 'Show private Archive');
DEFINE ('_UDDEIM_PM_ARCHIVE_DESC', 'Show archived private messages');
DEFINE ('_UDDEIM_PM_SENDMESSAGE', 'Message sent');
DEFINE ('_UDDEIM_PM_PMSTAB', 'Send message');
DEFINE ('_UDDEIM_PM_PROFILEMSG', 'Quick message');
DEFINE ('_UDDEIM_PM_SENTSUCCESS', 'Successfully sent.');
DEFINE ('_UDDEIM_PM_SESSIONTIMEOUT', 'Session timeout.');
DEFINE ('_UDDEIM_PM_NOTSENT', 'Message not sent.');
DEFINE ('_UDDEIM_PM_TRYAGAIN', 'Try again.');
DEFINE ('_UDDEIM_PM_EMPTYMESSAGE', 'Empty message.');
DEFINE ('_UDDEIM_PM_EMAILFORMSUBJECT', 'Subject');
DEFINE ('_UDDEIM_PM_EMAILFORMMESSAGE', 'Message');
DEFINE ('_UDDEIM_PM_TABINBOX', 'Inbox');
DEFINE ('_UDDEIM_PM_PMSLINK', 'Private Messaging');
// New: 3.5
DEFINE ('_UDDEADM_GROUPSADMIN_HEAD', 'Additional Admin groups');
DEFINE ('_UDDEADM_GROUPSADMIN_EXP', 'Enter group IDs which should be treated as admin groups (e.g. 10, 11, 17). IDs 7, 8 (Joomla >=1.6) and IDs 24, 25 (Joomla <=1.5) are always admins.');
DEFINE ('_UDDEADM_GROUPSSPECIAL_HEAD', 'Additional Special groups');
DEFINE ('_UDDEADM_GROUPSSPECIAL_EXP', 'Enter group IDs which should be treated as special groups (e.g. 10, 11, 17). IDs 3-8 (Joomla >=1.6) and IDs 19-25 (Joomla <=1.5) are always special users.');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_15', '...set default for additonal groups');
// New: 3.3
DEFINE ('_UDDEADM_KUNENA30', 'Kunena 3.0+');
// New: 3.1
DEFINE ('_UDDEIM_BADWORD', 'Bad word detected');
DEFINE ('_UDDEADM_BADWORDS_HEAD', 'Badwords filter');
DEFINE ('_UDDEADM_BADWORDS_EXP', 'New messages will be filtered for badwords. All badwords have to be seperated by a semicolon (;).');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_14', '...set default for badwords filter');
DEFINE ('_UDDEADM_OOD_PB', 'Postbox Plugin out of date!');
// New: 3.0
DEFINE ('_UDDEADM_UDDEIM', 'uddeIM');
DEFINE ('_UDDEADM_REPLYTEXT_HEAD', 'Auto reply');
DEFINE ('_UDDEADM_REPLYTEXT_EXP', 'The original message will be included automatically when you reply to a message.');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_13', '...set default for replys (options)');
// New: 2.9
DEFINE ('_UDDEADM_KUNENA20', 'Kunena 2.0+');
DEFINE ('_UDDEADM_POSTBOXFULL_HEAD', 'Full message text');
DEFINE ('_UDDEADM_POSTBOXFULL_EXP', 'Show full message text of none, first or all messages.');
DEFINE ('_UDDEADM_POSTBOXFULL_0', 'None');
DEFINE ('_UDDEADM_POSTBOXFULL_1', 'First');
DEFINE ('_UDDEADM_POSTBOXFULL_2', 'All');
DEFINE ('_UDDEADM_POSTBOXAVATARS_HEAD', 'Display Avatars');
DEFINE ('_UDDEADM_POSTBOXAVATARS_EXP', 'Display Avatars in message view.');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_12', '...set default for postbox (options)');
// New: 2.8
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_11', '...set default for postbox');
DEFINE ('_UDDEADM_POSTBOX_HEAD', 'Enable Postbox');
DEFINE ('_UDDEADM_POSTBOX_EXP', 'Enables the Postbox.');
DEFINE ('_UDDEIM_FILTER_TITLE_POSTBOX', 'Show from/to this user only');
DEFINE ('_UDDEIM_MESSAGES', 'Messages');
DEFINE ('_UDDEIM_POSTBOX', 'Postbox');
DEFINE ('_UDDEIM_FILTEREDUSER', 'user filtered');
DEFINE ('_UDDEIM_FILTEREDUSERS', 'users filtered');
DEFINE ('_UDDEIM_NOMESSAGES_FILTERED_POSTBOX', ' postbox');
DEFINE ('_UDDEIM_NOMESSAGES_POSTBOX', 'You have no messages in your postbox.');
DEFINE ('_UDDEIM_DISPLAY', 'Display');
DEFINE ('_UDDEIM_HELP_POSTBOX', 'The <b>Postbox</b> holds all your incoming and outgoing messages.');
DEFINE ('_UDDEIM_HELP_PREAD', 'The message has been read (inbox=you can toggle the status).');
DEFINE ('_UDDEIM_HELP_PUNREAD', 'The message is still unread (inbox=you can toggle the status).');
// New: 2.7
DEFINE ('_UDDEADM_MOOTOOLS_NONEMEIO', 'do not load MooTools (use MEIO)');
DEFINE ('_UDDEADM_MOOTOOLS_13MEIO', 'force loading MooTools 1.3 (use MEIO)');
// New: 2.6
DEFINE ('_UDDEADM_DONTSEFMSGLINK_HEAD', 'No SEF for %msglink%');
DEFINE ('_UDDEADM_DONTSEFMSGLINK_EXP', 'Do not use SEF for %msglink% placeholder in email notifications.');
DEFINE ('_UDDEADM_STIME_HEAD', 'Use special calendars');
DEFINE ('_UDDEADM_STIME_EXP', 'When enabled on sites using the farsi language file the persian calendar is used.');
DEFINE ('_UDDEADM_RESTRICTREM_HEAD', 'Remove orphaned connections');
DEFINE ('_UDDEADM_RESTRICTREM_EXP', 'Automatically remove orphaned connections when saving an existing contact list.');
DEFINE ('_UDDEADM_RESTRICTCON_HEAD', 'Show connections only');
DEFINE ('_UDDEADM_RESTRICTCON_EXP', 'The users shown in the list can be restricted to CB/CBE/JS connections (hide users from userlist has no effect here when enabled).');
DEFINE ('_UDDEADM_RESTRICTCON0', 'disabled');
DEFINE ('_UDDEADM_RESTRICTCON1', 'registered users');
DEFINE ('_UDDEADM_RESTRICTCON2', 'registered, special users');
DEFINE ('_UDDEADM_RESTRICTCON3', 'all users (incl. admins)');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_10', '...set default for show connections');
// New: 2.4
DEFINE ('_UDDEIM_SECURITYCODE', 'Security Code:');
// New: 2.3
DEFINE ('_UDDEADM_CC_HEAD', 'Button "Show CC: line"');
DEFINE ('_UDDEADM_CC_EXP', 'When enabled a user can choose if uddeIM shall add a CC: line containing all recipients to a message or not.');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_9', '...set default for CC: line, and moderation');
DEFINE ('_UDDEIM_TOOLBAR_MCP', 'Message Center');
DEFINE ('_UDDEIM_TOOLBAR_REMOVEMESSAGE', 'Delete message');
DEFINE ('_UDDEIM_TOOLBAR_DELIVERMESSAGE', 'Deliver message');
DEFINE ('_UDDEADM_OOD_MCP', 'Message Center Plugin out of date!');
DEFINE ('_UDDEADM_MCP_STAT', 'Messages to moderate:');
DEFINE ('_UDDEADM_MCP_TRASHED', 'Trashed');
DEFINE ('_UDDEADM_MCP_NOTEDEL', 'Delete this message from database?');
DEFINE ('_UDDEADM_MCP_NOTEDELIVER', 'Deliver this message to recipient?');
DEFINE ('_UDDEADM_MCP_SHOWHIDE', 'Show/Hide');
DEFINE ('_UDDEADM_MCP_EDIT', 'Message Control Center');
DEFINE ('_UDDEADM_MCP_FROM', 'From');
DEFINE ('_UDDEADM_MCP_TO', 'To');
DEFINE ('_UDDEADM_MCP_TEXT', 'Message');
DEFINE ('_UDDEADM_MCP_DELETE', 'Delete');
DEFINE ('_UDDEADM_MCP_DATE', 'Date');
DEFINE ('_UDDEADM_MCP_DELIVER', 'Deliver');
DEFINE ('_UDDEADM_USERSET_MODERATE', 'Mod');
DEFINE ('_UDDEADM_USERSET_SELMODERATE', '- Mod -');
DEFINE ('_UDDEIM_MCP_MODERATED', 'Your messages will be moderated. A moderator will check them before they are delivered to the recipients.');
DEFINE ('_UDDEIM_STATUS_DELAYED', 'Waiting for moderator');
DEFINE ('_UDDEADM_MODNEWUSERS_HEAD', 'Moderate new users');
DEFINE ('_UDDEADM_MODNEWUSERS_EXP', 'When enabled messages from new registered users are moderated by default.');
DEFINE ('_UDDEADM_MODPUBUSERS_HEAD', 'Moderate public users');
DEFINE ('_UDDEADM_MODPUBUSERS_EXP', 'When enabled messages from public users users are moderated.');
DEFINE ('_UDDEIM_MENUICONS_P3', 'No menu');
// New: 2.2
DEFINE ('_UDDEADM_OOD_PF', 'Public Frontend Plugin out of date!');
DEFINE ('_UDDEADM_OOD_A', 'File Attachment Plugin out of date!');
DEFINE ('_UDDEADM_OOD_RSS', 'RSS Plugin out of date!');
DEFINE ('_UDDEADM_OOD_ASC', 'Message Report Center Plugin out of date!');
DEFINE ('_UDDEIM_NOMESSAGES3_FILTERED', '<b>Bạn không có tin nhắn đã được lọc trong %s.</b>');
DEFINE ('_UDDEIM_FILTER_UNREAD', 'chưa đọc');
DEFINE ('_UDDEIM_FILTER_FLAGGED', 'đánh dấu cờ');
DEFINE ('_UDDEADM_GRAVATAR_HEAD', 'gravatar enabled');
DEFINE ('_UDDEADM_GRAVATAR_EXP', 'Enables gravatar support.');
DEFINE ('_UDDEADM_GRAVATARD_HEAD', 'gravatar imageset');
DEFINE ('_UDDEADM_GRAVATARD_EXP', 'Select the imageset for default images.');
DEFINE ('_UDDEADM_GRAVATARR_HEAD', 'gravatar rating');
DEFINE ('_UDDEADM_GRAVATARR_EXP', 'By default, only "G" rated images are displayed unless you indicate higher ratings. "X" displays all gravatar images.');
DEFINE ('_UDDEADM_GR404', '404');
DEFINE ('_UDDEADM_GRMM', 'mm');
DEFINE ('_UDDEADM_GRIDENTICON', 'identicon');
DEFINE ('_UDDEADM_GRMONSTERID', 'monsterid');
DEFINE ('_UDDEADM_GRWAVATAR', 'wavatar');
DEFINE ('_UDDEADM_GRRETRO', 'retro');
DEFINE ('_UDDEADM_GRDEFAULT', 'default');
DEFINE ('_UDDEADM_GRG', 'G = General');
DEFINE ('_UDDEADM_GRPG', 'PG = Parental Guidance');
DEFINE ('_UDDEADM_GRR', 'R = Restricted');
DEFINE ('_UDDEADM_GRX', 'X = Adult only');
DEFINE ('_UDDEADM_NINJABOARD', 'Ninjaboard');
DEFINE ('_UDDEADM_KUNENA16', 'Kunena 1.6+');
DEFINE ('_UDDEIM_PROCESSING', 'Đang xử lý...');
DEFINE ('_UDDEIM_SEND_NONOTIFY', 'Không gửi email thông báo');
DEFINE ('_UDDEIM_SYSGM_NONOTIFY', 'Email thông báo sẽ không được gửi');
DEFINE ('_UDDEIM_SYSGM_FORCEEMBEDDED', 'Nội dung sẽ được gửi kèm trong email thông báo');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_8', '...set default for thumbnails');
DEFINE ('_UDDEADM_AVATARWH_HEAD', 'Display size of thumbnails');
DEFINE ('_UDDEADM_AVATARWH_EXP', 'Width and height (in pixels) of thumbnails (0 = size will not be changed).');
DEFINE ('_UDDEIM_SAVE', 'Lưu');
// New: 2.1
DEFINE ('_UDDEIM_BODY_SPAMREPORT',
"Hi %you%,\n\n%touser% đã báo cáo tin nhắn spam từ %fromuser%. Vui lòng đăng nhập để kiểm tra!\n\n%livesite%");
DEFINE ('_UDDEIM_SUBJECT_SPAMREPORT', 'Một tin nhắn đã bị báo cáo tại %site%');
DEFINE ('_UDDEADM_KBYTES', 'KByte');
DEFINE ('_UDDEADM_MBYTES', 'MByte');
DEFINE ('_UDDEIM_ATT_FILEDELETED', 'Đã xóa file');
DEFINE ('_UDDEIM_ATT_FILENOTEXISTS', 'Lỗi: File không tồn tại');
DEFINE ('_UDDEIM_ATTACHMENTS2', 'Đính kèm (Tối đa. %s / file):');
DEFINE ('_UDDEADM_JOOCM', 'Joo!CM');
DEFINE ('_UDDEADM_UNPROTECTATTACHMENT_HEAD', 'Unprotected file downloads');
DEFINE ('_UDDEADM_UNPROTECTATTACHMENT_EXP', 'Usually uddeIM does not disclose the server path of file attachments, so nobody - even when the filename is known - can download the file. Enabling this option forces uddeIM to return the full server path. For security reasons, uddeIM added a MD5 hash to the original file name. Users can download the file directly when the full path is known. Do only use with care! READ THE FAQ WHEN USING THIS OPTION!');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_7', '...set default for file attachments, public frontend');
DEFINE ('_UDDEIM_FILETYPE_NOTALLOWED', 'Định dạng file không được phép');
DEFINE ('_UDDEADM_ALLOWEDEXTENSIONS_HEAD', 'Extensions allowed');
DEFINE ('_UDDEADM_ALLOWEDEXTENSIONS_EXP', 'Enter all extensions allowed (separated by ";"). Leave blank for no restrictions.');
DEFINE ('_UDDEADM_PUBEMAIL_HEAD', 'Email required');
DEFINE ('_UDDEADM_PUBEMAIL_EXP', 'When enabled a public user has to enter an email address.');
DEFINE ('_UDDEADM_WAITDAYS_HEAD', 'Days to wait');
DEFINE ('_UDDEADM_WAITDAYS_EXP', 'Specify how many days a user must wait until he is allowed to send messages (for 3 hours enter 0.125).');
DEFINE ('_UDDEIM_WAITDAYS1', 'Bạn phải đợi ');
DEFINE ('_UDDEIM_WAITDAYS2', ' ngày để có thể gửi tin nhắn.');
DEFINE ('_UDDEIM_WAITDAYS2H', ' giờ để có thể gửi tin nhắn.');
// New: 2.0
DEFINE ('_UDDEADM_RECAPTCHAPRV_HEAD', 'reCaptcha private key');
DEFINE ('_UDDEADM_RECAPTCHAPRV_EXP', 'When you want to use reCaptcha, enter your private key here.');
DEFINE ('_UDDEADM_RECAPTCHAPUB_HEAD', 'reCaptcha public key');
DEFINE ('_UDDEADM_RECAPTCHAPUB_EXP', 'When you want to use reCaptcha, enter your public key here.');
DEFINE ('_UDDEADM_CAPTCHA_INTERNAL', 'Internal');
DEFINE ('_UDDEADM_CAPTCHA_RECAPTCHA', 'reCaptcha');
DEFINE ('_UDDEADM_CAPTCHATYPE_HEAD', 'Captcha service');
DEFINE ('_UDDEADM_CAPTCHATYPE_EXP', 'Which captcha service do you want to use: The build-in service or reCaptcha (see <a href="http://recaptcha.net" target="_new">reCaptcha</a> for more information)?');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_6', '...set default for captcha service');
DEFINE ('_UDDEADM_AUP', 'AlphaUserPoints');
DEFINE ('_UDDEADM_CHECKFILESFOLDER', 'Please move <i>\uddeimfiles</i> to <i>\images\uddeimfiles</i>. Check the documentation!');
DEFINE ('_UDDEADM_CRYPT4', 'Strong encryption');
DEFINE ('_UDDEADM_ALLOWTOALL2_HEAD', 'Allow sending system messages');
DEFINE ('_UDDEADM_ALLOWTOALL2_EXP', 'uddeIM supports system messages. They are sent to all users on your system. Use them sparingly.');
DEFINE ('_UDDEADM_ALLOWTOALL2_0', 'disabled');
DEFINE ('_UDDEADM_ALLOWTOALL2_1', 'admins only');
DEFINE ('_UDDEADM_ALLOWTOALL2_2', 'admins and managers');
// New: 1.9
DEFINE ('_UDDEIM_FILEUPLOAD_FAILED', 'Lỗi upload file');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_5', '...set default for file attachments');
DEFINE ('_UDDEADM_ENABLEATTACHMENT_HEAD', 'Enable file attachments');
DEFINE ('_UDDEADM_ENABLEATTACHMENT_EXP', 'This enables sending file attachments for all registered users or admins only.');
DEFINE ('_UDDEADM_MAXSIZEATTACHMENT_HEAD', 'Max. file size');
DEFINE ('_UDDEADM_MAXSIZEATTACHMENT_EXP', 'Maximum file size allowed for file attachments.');
DEFINE ('_UDDEIM_FILESIZE_EXCEEDED', 'Vượt quá số lượng file tối đa cho phép');
DEFINE ('_UDDEADM_BYTES', 'Bytes');
DEFINE ('_UDDEADM_MAXATTACHMENTS_HEAD', 'Max. attachments');
DEFINE ('_UDDEADM_MAXATTACHMENTS_EXP', 'Maximum number of attachments per message.');
DEFINE ('_UDDEIM_DOWNLOAD', 'Tải xuống');
DEFINE ('_UDDEADM_FILEADMINIGNITIONONLY_HEAD', 'File deletions invoked');
DEFINE ('_UDDEADM_FILEADMINIGNITIONONLY_YES', 'by admins only');
DEFINE ('_UDDEADM_FILEADMINIGNITIONONLY_NO', 'by any user');
DEFINE ('_UDDEADM_FILEADMINIGNITIONONLY_MANUALLY', 'manually');
DEFINE ('_UDDEADM_FILEADMINIGNITIONONLY_EXP', 'Automatic deletions create heavy server load. If you choose <b>by admins only</b> automatic deletions are invoked when an admin checks his inbox. Choose this option if an admin is checking the inbox regulary. Small or rarely administered sites may choose <b>by any user</b>.');
DEFINE ('_UDDEADM_FILEMAINTENANCE_PRUNE', 'Prune files now');
DEFINE ('_UDDEADM_FILEMAINTENANCEDEL_HEAD', 'Invoke file erasing');
DEFINE ('_UDDEADM_FILEMAINTENANCEDEL_EXP', 'Removes deleted files from the database. This is the same as \'Prune files now\' on the system tab.');
DEFINE ('_UDDEADM_FILEMAINTENANCEDEL_ERASE', 'ERASE');
DEFINE ('_UDDEIM_ATTACHMENTS', 'Đính kèm (Tối đa: %u bytes trên một file):');
DEFINE ('_UDDEADM_MAINTENANCE_F1', 'Orphaned attachments stored in filesystem: ');
DEFINE ('_UDDEADM_MAINTENANCE_F2', 'Deleting orphaned files');
DEFINE ('_UDDEADM_BACKUP_DONE', 'Backup configuration done.');
DEFINE ('_UDDEADM_RESTORE_DONE', 'Restore configuration done.');
DEFINE ('_UDDEADM_PRUNE_DONE', 'Message pruning done.');
DEFINE ('_UDDEADM_FILEPRUNE_DONE', 'File attachment pruning done.');
DEFINE ('_UDDEADM_FOLDERCREATE_ERROR', 'Error creating folder: ');
DEFINE ('_UDDEADM_ATTINSTALL_WRITEFAILED', 'Error creating file: ');
DEFINE ('_UDDEADM_ATTINSTALL_IGNORE', 'You can ignore this error when you do not own the File attachments premium plugin (see FAQ).');
DEFINE ('_UDDEADM_ATTACHMENTGROUPS_HEAD', 'Allowed groups');
DEFINE ('_UDDEADM_ATTACHMENTGROUPS_EXP', 'Groups which are allowed to send file attachments.');
DEFINE ('_UDDEIM_SELECT', 'Chọn');
DEFINE ('_UDDEIM_ATTACHMENT', 'Đính kèm');
DEFINE ('_UDDEADM_SHOWLISTATTACHMENT_HEAD', 'Show attachment icons');
DEFINE ('_UDDEADM_SHOWLISTATTACHMENT_EXP', 'Show attachment icons in the message lists (inbox, outbox, archive).');
DEFINE ('_UDDEIM_HELP_ATTACHMENT', 'Tin nhắn bao gồm 1 file đính kèm.');
DEFINE ('_UDDEADM_MAINTENANCE_COUNTFILES', 'File references in database:');
DEFINE ('_UDDEADM_MAINTENANCE_COUNTFILESDISTINCT', 'File attachments stored:');
DEFINE ('_UDDEADM_SHOWMENUCOUNT_HEAD', 'Show counters');
DEFINE ('_UDDEADM_SHOWMENUCOUNT_EXP', 'When set to <b>yes</b>, the menu bar contains message counters. Note: This will require several additional database queries so do not use on weak systems.');
DEFINE ('_UDDEADM_CONFIG_FTPLAYER', 'Configuration (access with FTP layer):');
DEFINE ('_UDDEADM_ENCODEHEADER_HEAD', 'Encode mail headers');
DEFINE ('_UDDEADM_ENCODEHEADER_EXP', 'Set to <b>yes</b>, when mail headers (like the subject) should be rfc 2047 encoded. Useful when you have problems with special characters.');
DEFINE ('_UDDEIM_UP', 'sắp xếp tăng dần');
DEFINE ('_UDDEIM_DOWN', 'sắp xếp giảm dần');
DEFINE ('_UDDEIM_UPDOWN', 'Sắp xếp');
DEFINE ('_UDDEADM_ENABLESORT_HEAD', 'Enable sorting');
DEFINE ('_UDDEADM_ENABLESORT_EXP', 'Set to <b>yes</b>, when the user should be able to sort the inbox, outbox and archive (creates additional load on the database server).');
// New: 1.8
// %s will be replaced by _UDDEIM_NOMESSAGES_FILTERED_INBOX, _UDDEIM_NOMESSAGES_FILTERED_OUTBOX, _UDDEIM_NOMESSAGES_FILTERED_ARCHIVE
// Translators help: When having problems with the grammar, you can also move some text (e.g. "in your") to _UDDEIM_NOMESSAGES_FILTERED_* variables, e.g.
// instead of "_UDDEIM_NOMESSAGES_FILTERED_INBOX=inbox" you can also use "_UDDEIM_NOMESSAGES_FILTERED_INBOX=in your inbox"
DEFINE ('_UDDEIM_NOMESSAGES2_FR_FILTERED', '<b>Bạn không có tin nhắn từ thành viên này trong%s.</b>');
DEFINE ('_UDDEIM_NOMESSAGES2_TO_FILTERED', '<b>Bạn không có tin nhắn tới thành viên này trong%s.</b>');
DEFINE ('_UDDEIM_NOMESSAGES2_UNFR_FILTERED', '<b>Bạn không có tin nhắn chưa đọc từ thành viên này trong%s.</b>');
DEFINE ('_UDDEIM_NOMESSAGES2_UNTO_FILTERED', '<b>Bạn không có tin nhắn chưa đọc tới thành viên này trong%s.</b>');
// New: 1.7
DEFINE ('_UDDEADM_EMAILSTOPPED', '\'Email stop\' enabled.');
DEFINE ('_UDDEIM_ACCOUNTLOCKED', 'Truy cập vào hộp tin nhắn của bạn đã bị khóa. Vui lòng liên hệ admin để biết lí do.');
DEFINE ('_UDDEADM_USERSET_LOCKED', 'Locked');
DEFINE ('_UDDEADM_USERSET_SELLOCKED', '- Locked -');
DEFINE ('_UDDEADM_CBBANNED_HEAD', 'Check for CB banned users');
DEFINE ('_UDDEADM_CBBANNED_EXP', 'When activated uddeIM checks if a user has been banned in CB and does not allow access to uddeIM. Additionally other users are not able to send messages to a banned user.');
DEFINE ('_UDDEIM_YOUAREBANNED', 'Tài khoản của bạn đã bị khóa. Vui lòng liên hệ admin để biết lí do.');
DEFINE ('_UDDEIM_USERBANNED', 'Đã khóa tài khoản thành viên.');
DEFINE ('_UDDEADM_JOOBB', 'Joo!BB');
DEFINE ('_UDDEPLUGIN_SEARCHSECTION', 'Tin nhắn riêng');
DEFINE ('_UDDEPLUGIN_MESSAGES', 'Tin nhắn riêng');
DEFINE ('_UDDEADM_MAINTENANCEDEL_HEAD', 'Invoke message erasing');
// note "This is the same as _UDDEADM_MAINTENANCE_PRUNE on the system tab."
DEFINE ('_UDDEADM_MAINTENANCEDEL_EXP', 'Removes deleted messages from the database. This is the same as \'Prune messages now\' on the system tab.');
DEFINE ('_UDDEADM_MAINTENANCEDEL_ERASE', 'ERASE');
DEFINE ('_UDDEADM_REPORTSPAM_HEAD', 'Report message link');
DEFINE ('_UDDEADM_REPORTSPAM_EXP', 'When activated this show a \'Report message\' link that allows users to report SPAM to the admin.');
DEFINE ('_UDDEIM_TOOLBAR_REMOVESPAM', 'Xóa tin nhắn');
DEFINE ('_UDDEIM_TOOLBAR_REMOVEREPORT', 'Hủy báo cáo');
DEFINE ('_UDDEIM_TOOLBAR_SPAMCONTROL', 'Cấu hình báo cáo');
DEFINE ('_UDDEADM_INFORMATION', 'Information');
DEFINE ('_UDDEADM_SPAMCONTROL_STAT', 'Reported messages:');
DEFINE ('_UDDEADM_SPAMCONTROL_TRASHED', 'Trashed');
DEFINE ('_UDDEADM_SPAMCONTROL_NOTEDEL', 'Delete this message from database?');
DEFINE ('_UDDEADM_SPAMCONTROL_NOTEREMOVE', 'Remove this report?');
DEFINE ('_UDDEADM_SPAMCONTROL_SHOWHIDE', 'Show/Hide');
DEFINE ('_UDDEADM_SPAMCONTROL_EDIT', 'Report Control Center');
DEFINE ('_UDDEADM_SPAMCONTROL_FROM', 'From');
DEFINE ('_UDDEADM_SPAMCONTROL_TO', 'To');
DEFINE ('_UDDEADM_SPAMCONTROL_TEXT', 'Message');
DEFINE ('_UDDEADM_SPAMCONTROL_DELETE', 'Delete');
DEFINE ('_UDDEADM_SPAMCONTROL_REMOVE', 'Remove');
DEFINE ('_UDDEADM_SPAMCONTROL_DATE', 'Date');
DEFINE ('_UDDEADM_SPAMCONTROL_REPORTED', 'Reported');
DEFINE ('_UDDEIM_SPAMCONTROL_REPORT', 'Báo cáo spam');
DEFINE ('_UDDEIM_SPAMCONTROL_MARKED', 'Đã báo cáo');
DEFINE ('_UDDEIM_SPAMCONTROL_UNREPORT', 'Hủy báo cáo');
DEFINE ('_UDDEADM_JOMSOCIAL', 'JomSocial');
DEFINE ('_UDDEADM_KUNENA', 'Kunena');
DEFINE ('_UDDEADM_ADMIN_FILTER', 'Filter');
DEFINE ('_UDDEADM_ADMIN_DISPLAY', 'Display #');
DEFINE ('_UDDEADM_TRASHORIGINALSENT_HEAD', 'Trash sent message');
DEFINE ('_UDDEADM_TRASHORIGINALSENT_EXP', 'When activated this will put a checkbox next to the \'Send\' button called \'trash message\' that is not checked by default. Users can check the box if they want to trash a message immediatly after sending it.');
DEFINE ('_UDDEIM_TRASHORIGINALSENT', 'xóa tin nhắn');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_4', '...set default for delete sent message, report spam, CB banned users');
DEFINE ('_UDDEADM_VERSIONCHECK_IMPORTANT', 'Important links:');
DEFINE ('_UDDEADM_VERSIONCHECK_HOTFIX', 'Hotfix');
DEFINE ('_UDDEADM_VERSIONCHECK_NONE', 'None');
DEFINE ('_UDDEADM_MAINTENANCEFIX_HEAD', "Compatibility maintenance");
DEFINE ('_UDDEADM_MAINTENANCEFIX_EXP', "uddeIM uses two XML files to ensure that packages can be installed on Joomla 1.0 and 1.5. On Joomla 1.5 one XML file is not required and this makes the extension manager to show an incompatibilty warning (which is wrong). This removes the unnecessary files, so the warning is not longer displayed.");
DEFINE ('_UDDEADM_MAINTENANCE_FIX', "FIX");
DEFINE ('_UDDEADM_MAINTENANCE_XML1', "Joomla 1.0 and Joomla 1.5 XML installers for uddeIM packages exists.<br />");
DEFINE ('_UDDEADM_MAINTENANCE_XML2', "This is required due to install packages on Joomla 1.0 and Joomla 1.5.<br />");
DEFINE ('_UDDEADM_MAINTENANCE_XML3', "Since it is not required after the installation has been finished, Joomla 1.0 installer can be removed on Joomla 1.5 systems.<br />");
DEFINE ('_UDDEADM_MAINTENANCE_XML4', "This will be done for following packages:<br />");
DEFINE ('_UDDEADM_MAINTENANCE_FXML1', "Unnecessary XML installers for following uddeIM packages will be removed:<br />");
DEFINE ('_UDDEADM_MAINTENANCE_FXML2', "No unnecessary XML installers for uddeIM packages found!<br />");
DEFINE ('_UDDEADM_SHOWMENUICONS1_HEAD', 'Appearance of menu bar');
DEFINE ('_UDDEADM_SHOWMENUICONS1_EXP', 'Here you can configure if the menu bar should be displayed with icons and/or text.');
DEFINE ('_UDDEIM_MENUICONS_P1', 'Biểu tượng và chữ');
DEFINE ('_UDDEIM_MENUICONS_P2', 'Chỉ có biểu tượng');
DEFINE ('_UDDEIM_MENUICONS_P0', 'Chỉ có chữ');
DEFINE ('_UDDEIM_LISTSLIMIT_2', 'Số người nhận tối đa trong danh sách:');
DEFINE ('_UDDEADM_ADDEMAIL_ADMIN', 'Admins can select');
DEFINE ('_UDDEAIM_ADDEMAIL_SELECT', 'Thông báo kèm tin nhắn');
DEFINE ('_UDDEAIM_ADDEMAIL_TITLE', 'Bao gồm toàn bộ tin nhắn trong email thông báo.');
// New: 1.6
DEFINE ('_UDDEIM_NOLISTSELECTED', 'Chưa chọn danh sách liên lạc nào!');
DEFINE ('_UDDEADM_NOPREMIUM', 'Premium plugin not installed');
DEFINE ('_UDDEIM_LISTGLOBAL_CREATOR', 'Người tạo:');
DEFINE ('_UDDEIM_LISTGLOBAL_ENTRIES', 'Số thành viên');
DEFINE ('_UDDEIM_LISTGLOBAL_TYPE', 'Kiểu');
DEFINE ('_UDDEIM_LISTGLOBAL_NORMAL', 'Thông thường');
DEFINE ('_UDDEIM_LISTGLOBAL_GLOBAL', 'Dùng chung');
DEFINE ('_UDDEIM_LISTGLOBAL_RESTRICTED', 'Riêng biệt');
DEFINE ('_UDDEIM_LISTGLOBAL_P0', 'Nhóm thông thường');
DEFINE ('_UDDEIM_LISTGLOBAL_P1', 'Nhóm dùng chung');
DEFINE ('_UDDEIM_LISTGLOBAL_P2', 'Nhóm riêng biệt (chỉ các thành viên trong nhóm mới có thể truy cập)');
DEFINE ('_UDDEIM_TOOLBAR_USERSETTINGS', 'Thiết lập của thành viên');
DEFINE ('_UDDEIM_TOOLBAR_REMOVESETTINGS', 'Xóa thiết lập');
DEFINE ('_UDDEIM_TOOLBAR_CREATESETTINGS', 'Tạo thiết lập');
DEFINE ('_UDDEIM_TOOLBAR_SAVE', 'Lưu');
DEFINE ('_UDDEIM_TOOLBAR_BACK', 'Quay lại');
DEFINE ('_UDDEIM_TOOLBAR_TRASHMSGS', 'Xóa tin nhắn');
DEFINE ('_UDDEIM_CBPLUG_CONT', '[Tiếp tục]');
DEFINE ('_UDDEIM_CBPLUG_UNBLOCKNOW', '[Mở khóa]');
DEFINE ('_UDDEIM_CBPLUG_DOBLOCK', 'Khóa thành viên');
DEFINE ('_UDDEIM_CBPLUG_DOUNBLOCK', 'Mở khóa thành viên');
DEFINE ('_UDDEIM_CBPLUG_BLOCKINGCFG', 'Khóa thành viên');
DEFINE ('_UDDEIM_CBPLUG_BLOCKED', 'Bạn đã khóa thành viên này.');
DEFINE ('_UDDEIM_CBPLUG_UNBLOCKED', 'Thành viên này có thể liên lạc với bạn.');
DEFINE ('_UDDEIM_CBPLUG_NOWBLOCKED', 'Thành viên đã bị khóa.');
DEFINE ('_UDDEIM_CBPLUG_NOWUNBLOCKED', 'Thành viên đã được mở khóa.');
DEFINE ('_UDDEADM_PARTIALIMPORTDONE', 'Partial import of messages from old PMS done. Do not import this part again because doing so will import the messages again and they will show up twice.');
DEFINE ('_UDDEADM_IMPORT_HELP', 'Note: The messages can be imported all at once or in parts. Importing in parts can be necessary when the import dies because of too many messages to import.');
DEFINE ('_UDDEADM_IMPORT_PARTIAL', 'Partial import:');
DEFINE ('_UDDEADM_UPDATEYOURDB', 'Important: You have not updated your database! Please refer to the README how to update uddeIM correctly!');
DEFINE ('_UDDEADM_RESTRALLUSERS_HEAD', 'Restrict "All users" access');
DEFINE ('_UDDEADM_RESTRALLUSERS_EXP', 'You can restrict the access to the "All users" list. Usually the "All users" list is available for all (<i>no restriction</i>).');
DEFINE ('_UDDEADM_RESTRALLUSERS_0', 'no restriction');
DEFINE ('_UDDEADM_RESTRALLUSERS_1', 'special users');
DEFINE ('_UDDEADM_RESTRALLUSERS_2', 'admins only');
DEFINE ('_UDDEIM_MESSAGE_UNARCHIVED', 'Message unarchived.');
DEFINE ('_UDDEADM_AUTOFORWARD_SPECIAL', 'special users');
DEFINE ('_UDDEIM_HELP', 'Trợ giúp');
DEFINE ('_UDDEIM_HELP_HEADLINE1', 'Trợ giúp tin nhắn');
DEFINE ('_UDDEIM_HELP_HEADLINE2', 'Tổng quan');
DEFINE ('_UDDEIM_HELP_INBOX', '<b>Hộp thư đến</b> Giữ tất cả các tin nhắn gửi đến bạn.');
DEFINE ('_UDDEIM_HELP_OUTBOX', '<b>Hộp thư đi</b> Giữ tất cả các tin nhắn mà bạn đã gửi, nó cho phép bạn xem các tin nhắn mà bạn đã gửi.');
DEFINE ('_UDDEIM_HELP_TRASHCAN', '<b>Thùng rác</b> Giữ các tin nhắn đã bị xóa. Tin nhắn bị xóa sẽ lưu trữ trong thùng rác trong một khoảng thời gian xác định. Nếu tin nhắn chưa bị xóa vĩnh viễn, bạn có thể khôi phục lại nó.');
DEFINE ('_UDDEIM_HELP_ARCHIVE', '<b>Lưu trữ</b> Giữ tất cả các tin nhắn lưu trữ trong hộp thư đến. Bạn chỉ có thể lưu trữ tin nhắn từ hộp thư đến. Nếu bạn muốn lưu trữ tin nhắn của chính mình, hãy chọn <i>Gửi một bản sao cho tôi</i> khi bạn gửi tin nhắn.');
DEFINE ('_UDDEIM_HELP_USERLISTS', '<b>Liên hệ</b> cho phép bạn tào danh sách liên hệ. Với sanh sách liên hệ bạn có thể gửi tin nhắn cho nhiều thành viên. Thay vì việc nhập tên nhiều thành viên, bạn chỉ cần nhập <i>#Tên_danh_sách</i>.');
DEFINE ('_UDDEIM_HELP_SETTINGS', '<b>Thiết lập</b> Bao gồm tất cả các tùy chọn của thành viên.');
DEFINE ('_UDDEIM_HELP_COMPOSE', '<b>Soạn tin</b> cho phép bạn tạo tin nhắn mới.');
DEFINE ('_UDDEIM_HELP_IREAD', 'Tin nhắn đã được đọc (Bạn có thể thêm Trạng thái).');
DEFINE ('_UDDEIM_HELP_IUNREAD', 'Tin nhắn vẫn chưa được đọc (Bạn có thể thêm Trạng thái).');
DEFINE ('_UDDEIM_HELP_OREAD', 'Tin nhắn đã được đọc.');
DEFINE ('_UDDEIM_HELP_OUNREAD', 'Tin nhắn vẫn chưa được đọc. Bạn có thể lấy lại các tin nhắn chưa được đọc.');
DEFINE ('_UDDEIM_HELP_TREAD', 'Tin nhắn đã được đọc.');
DEFINE ('_UDDEIM_HELP_TUNREAD', 'Tin nhắn vẫn chưa được đọc.');
DEFINE ('_UDDEIM_HELP_FLAGGED', 'Tin nhắn đã được gắn cờ, e.g. Khi nó là tin nhắn quan trọng (Bạn có thể thêm Trạng thái).');
DEFINE ('_UDDEIM_HELP_UNFLAGGED', 'Tin nhắn <i>thông thường</i> (Bạn có thể thêm Trạng thái).');
DEFINE ('_UDDEIM_HELP_ONLINE', 'Thành viên này đang Online.');
DEFINE ('_UDDEIM_HELP_OFFLINE', 'Thành viên này đang Offline.');
DEFINE ('_UDDEIM_HELP_DELETE', 'Xóa tin nhắn (Chuyển tin nhắn tới thùng rác).');
DEFINE ('_UDDEIM_HELP_FORWARD', 'Chuyển tiếp tin nhắn tới thành viên khác.');
DEFINE ('_UDDEIM_HELP_ARCHIVEMSG', 'Lưu trữ tin nhắn. Tin nhắn lưu trữ sẽ không bị xóa ngay cả khi người quản trị giới hạn thời gian tồn tại của tin nhắn trong hộp thư đến.');
DEFINE ('_UDDEIM_HELP_UNARCHIVEMSG', 'Không lưu trữ tin nhắn. Tin nhắn sẽ được chuyển trở lại hộp thư đến.');
DEFINE ('_UDDEIM_HELP_RECALL', 'Lấy lại tin nhắn. Bạn có thể lấy lại tin nhắn khi người nhận chưa đọc nó.');
DEFINE ('_UDDEIM_HELP_RECYCLE', 'Khôi phục tin nhắn (Chuyển tin nhắn từ thùng rác vào hộp thư đến hoặc hộp thư đi).');
DEFINE ('_UDDEIM_HELP_NOTIFY', 'Cấu hình thông báo qua email khi có tin nhắn mới.');
DEFINE ('_UDDEIM_HELP_AUTORESPONDER', 'Tự động chuyển tiếp cho phép mỗi người nhận được phép trả lời trực tiếp.');
DEFINE ('_UDDEIM_HELP_AUTOFORWARD', 'Tin nhắn mới có thể tự động chuyển tiếp tới thành viên khác.');
DEFINE ('_UDDEIM_HELP_BLOCKING', 'Bạn có thể khóa thành viên. Những thành viên này sẽ không thể gửi tin nhắn tới bạn.');
DEFINE ('_UDDEIM_HELP_MISC', 'Cấu hình thêm');
DEFINE ('_UDDEIM_HELP_FEED', 'Bạn có thể truy nhập vào hộp thư đến qua RSS.');
DEFINE ('_UDDEADM_SEPARATOR_HEAD', 'Separator');
DEFINE ('_UDDEADM_SEPARATOR_EXP', 'Select the separator used for multiple recipients (default is ",").');
DEFINE ('_UDDEADM_SEPARATOR_P0', 'comma (default)');
DEFINE ('_UDDEADM_SEPARATOR_P1', 'semicolon');
DEFINE ('_UDDEADM_RSSLIMIT_HEAD', 'RSS items');
DEFINE ('_UDDEADM_RSSLIMIT_EXP', 'Limit the number of returned RSS items (0 for no limit).');
DEFINE ('_UDDEADM_SHOWHELP_HEAD', 'Show help button');
DEFINE ('_UDDEADM_SHOWHELP_EXP', 'When enabled a help button is displayed.');
DEFINE ('_UDDEADM_SHOWIGOOGLE_HEAD', 'Show iGoogle gadget button');
DEFINE ('_UDDEADM_SHOWIGOOGLE_EXP', 'When enabled an <i>Add to iGoogle</i> button for the uddeIM iGoogle gadget is displayed in the user preferences.');
DEFINE ('_UDDEADM_MOOTOOLS_NONE11', 'do not load MooTools (1.1 is used)');
DEFINE ('_UDDEADM_MOOTOOLS_NONE12', 'do not load MooTools (1.2 is used)');
DEFINE ('_UDDEIM_RSS_INTRO1', 'Bạn có thể truy nhập vào hộp thư đến qua RSS (0.91).');
DEFINE ('_UDDEIM_RSS_INTRO1B', 'Địa chỉ RSS:');
DEFINE ('_UDDEIM_RSS_INTRO2', 'Đây là địa chỉ RSS riêng hiển thị các tin nhắn chưa đọc trong hộp thư đến của bạn. Chỉ có bạn mới được cung cấp địa chỉ này. Không cung cấp địa chỉ này cho người khác nếu không họ có thể truy cập vào và đọc các tin nhắn của bạn.');
DEFINE ('_UDDEIM_RSS_FEED', 'RSS Tin nhắn');
DEFINE ('_UDDEIM_RSS_NOOBJECT', 'Không có thành phần lỗi...');
DEFINE ('_UDDEIM_RSS_USERBLOCKED', 'Thành viên bị khóa...');
DEFINE ('_UDDEIM_RSS_NOTALLOWED', 'Từ chối truy cập...');
DEFINE ('_UDDEIM_RSS_WRONGPASSWORD', 'Sai tên đăng nhập hoặc mật khẩu...');
DEFINE ('_UDDEIM_RSS_NOMESSAGES', 'Không có tin nhắn');
DEFINE ('_UDDEIM_RSS_NONEWMESSAGES', 'Không có tin nhắn mới');
DEFINE ('_UDDEADM_ENABLERSS_HEAD', 'Enable RSS');
DEFINE ('_UDDEADM_ENABLERSS_EXP', 'When this option is enabled, messages can be received via RSS feed. Users will find the required URL in their profile.');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_3', '...set default for RSS, iGoogle, help, separator');
DEFINE ('_UDDEADM_DELETEM_DELETING', 'Deleting messages:');
DEFINE ('_UDDEADM_DELETEM_FROMUSER', 'Deleting messages from user ');
DEFINE ('_UDDEADM_DELETEM_MSGSSENT', '- messages sent: ');
DEFINE ('_UDDEADM_DELETEM_MSGSRECV', '- messages received: ');
DEFINE ('_UDDEIM_PMNAV_THISISARESPONSE', 'Đây là tin nhắn trả lời cho:');
DEFINE ('_UDDEIM_PMNAV_THEREARERESPONSES', 'Trả lời cho:');
DEFINE ('_UDDEIM_PMNAV_DELETED', 'Tin nhắn không có hiệu lực');
DEFINE ('_UDDEIM_PMNAV_EXISTS', 'Chuyển tới tin nhắn');
DEFINE ('_UDDEIM_PMNAV_COPY2ME', '(Copy)');
DEFINE ('_UDDEADM_PMNAV_HEAD', 'Allow navigation');
DEFINE ('_UDDEADM_PMNAV_EXP', 'Shows a navigation bar which allows navigating through a thread.');
DEFINE ('_UDDEADM_MAINTENANCE_ALLDAYS', 'Messages:');
DEFINE ('_UDDEADM_MAINTENANCE_7DAYS', 'Messages in 7 days:');
DEFINE ('_UDDEADM_MAINTENANCE_30DAYS', 'Messages in 30 days:');
DEFINE ('_UDDEADM_MAINTENANCE_365DAYS', 'Messages in 365 days:');
DEFINE ('_UDDEADM_MAINTENANCE_HEAD1', 'Sending reminders to (Forgetmenot: %s days):');
DEFINE ('_UDDEADM_MAINTENANCE_HEAD2', 'In %s days sending reminders to:');
DEFINE ('_UDDEADM_MAINTENANCE_NO', 'No:');
DEFINE ('_UDDEADM_MAINTENANCE_USERID', 'User ID:');
DEFINE ('_UDDEADM_MAINTENANCE_TONAME', 'Name:');
DEFINE ('_UDDEADM_MAINTENANCE_MID', 'Message ID:');
DEFINE ('_UDDEADM_MAINTENANCE_WRITTEN', 'Written:');
DEFINE ('_UDDEADM_MAINTENANCE_TIMER', 'Timer:');
// New: 1.5
DEFINE ('_UDDEMODULE_ALLDAYS', ' tin nhắn');
DEFINE ('_UDDEMODULE_7DAYS', ' tin nhắn 7 ngày trước đây');
DEFINE ('_UDDEMODULE_30DAYS', ' tin nhắn 30 ngày trước đây');
DEFINE ('_UDDEMODULE_365DAYS', ' tin nhắn 365 ngày trước đây');
DEFINE ('_UDDEADM_EMN_SENDERMAIL_WARNING', '<br /><b>Note:<br />When using mosMail, you have to configure a valid email address!</b>');
DEFINE ('_UDDEIM_FILTEREDMESSAGE', 'tin nhắn đã được lọc');
DEFINE ('_UDDEIM_FILTEREDMESSAGES', 'tin nhắn đã được lọc');
DEFINE ('_UDDEIM_FILTER', 'Bộ lọc:');
DEFINE ('_UDDEIM_FILTER_TITLE_INBOX', 'Chỉ hiển thị từ những thành viên này');
DEFINE ('_UDDEIM_FILTER_TITLE_OUTBOX', 'Chỉ hiển thị tới những thành viên này');
DEFINE ('_UDDEIM_FILTER_UNREAD_ONLY', 'Chỉ các tin chưa đọc');
DEFINE ('_UDDEIM_FILTER_SUBMIT', 'Lọc tin nhắn');
DEFINE ('_UDDEIM_FILTER_ALL', '- Tất cả -');
DEFINE ('_UDDEIM_FILTER_PUBLIC', '- Thành viên khác -');
DEFINE ('_UDDEADM_FILTER_HEAD', 'Enable filtering');
DEFINE ('_UDDEADM_FILTER_EXP', 'If enabled users can filter their in/outbox to show only one recipient or sender.');
DEFINE ('_UDDEADM_FILTER_P0', 'disabled');
DEFINE ('_UDDEADM_FILTER_P1', 'above message list');
DEFINE ('_UDDEADM_FILTER_P2', 'below message list');
DEFINE ('_UDDEADM_FILTER_P3', 'above and below the list');
DEFINE ('_UDDEIM_NOMESSAGES_FILTERED', '<b>Bạn có %s tin nhắn%s trong%s.</b>'); // see next also six lines
DEFINE ('_UDDEIM_NOMESSAGES_FILTERED_UNREAD', ' Chưa đọc');
DEFINE ('_UDDEIM_NOMESSAGES_FILTERED_FROM', ' từ thành viên này');
DEFINE ('_UDDEIM_NOMESSAGES_FILTERED_TO', ' tới thành viên này');
DEFINE ('_UDDEIM_NOMESSAGES_FILTERED_INBOX', ' thư đến');
DEFINE ('_UDDEIM_NOMESSAGES_FILTERED_OUBOX', ' thư đi');
DEFINE ('_UDDEIM_NOMESSAGES_FILTERED_ARCHIVE', ' lưu trữ');
DEFINE ('_UDDEIM_TODP_TITLE', 'Người nhận');
DEFINE ('_UDDEIM_TODP_TITLE_CC', 'Một hoặc nhiều người nhận (Cách nhau bởi dấu phẩy)');
DEFINE ('_UDDEIM_ADDCCINFO_TITLE', 'When checked a line containing all recipients will be added to the message.');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_2', '...set default for autoresponder, autoforwarding, inputbox, filter');
DEFINE ('_UDDEADM_AUTORESPONDER_HEAD', 'Enable Autoresponder');
DEFINE ('_UDDEADM_AUTORESPONDER_EXP', 'When the autoresponder is enabled the user can enable an autoresponder notification in the personal user settings.');
DEFINE ('_UDDEIM_EMN_AUTORESPONDER', 'Bật trả lời tự động');
DEFINE ('_UDDEIM_AUTORESPONDER', 'Tự động trả lời');
DEFINE ('_UDDEIM_AUTORESPONDER_EXP', 'Chế độ tự động trả lời cho phép bạn trả lời các tin nhắn đến với nội dung định trước.');
DEFINE ('_UDDEIM_AUTORESPONDER_DEFAULT', "Xin lỗi, hiện tại mình không online.\nMình sẽ trả lời tin nhắn của bạn ngay khi mình online.");
DEFINE ('_UDDEADM_USERSET_AUTOR', 'AutoR');
DEFINE ('_UDDEADM_USERSET_SELAUTOR', '- AutoR -');
DEFINE ('_UDDEIM_USERBLOCKED', 'Thành viên bị khóa.');
DEFINE ('_UDDEADM_AUTOFORWARD_HEAD', 'Enable Autoforwarding');
DEFINE ('_UDDEADM_AUTOFORWARD_EXP', 'When the autoforwarding is enabled the user can forward new messages to another user automatically.');
DEFINE ('_UDDEIM_EMN_AUTOFORWARD', 'Bật tự động chuyển tiếp');
DEFINE ('_UDDEADM_USERSET_AUTOF', 'AutoF');
DEFINE ('_UDDEADM_USERSET_SELAUTOF', '- AutoF -');
DEFINE ('_UDDEIM_AUTOFORWARD', 'Tự động chuyển tiếp');
DEFINE ('_UDDEIM_AUTOFORWARD_EXP', 'Tin nhắn gửi tới bạn sẽ được tự động chuyển tới thành viên được chọn.');
DEFINE ('_UDDEIM_THISISAFORWARD', 'Tin nhắn tự động chuyển tiếp từ ');
DEFINE ('_UDDEADM_COLSROWS_HEAD', 'Message box (cols/rows)');
DEFINE ('_UDDEADM_COLSROWS_EXP', 'This specifies the columns and rows of the message box (default values are 60/10).');
DEFINE ('_UDDEADM_WIDTH_HEAD', 'Message box (width)');
DEFINE ('_UDDEADM_WIDTH_EXP', 'This specifies the width of the message box in px (default is 0). If this value is 0, the width specified in the CSS style is used.');
DEFINE ('_UDDEADM_CBE', 'CB Enhanced');
// New: 1.4
DEFINE ('_UDDEADM_IMPORT_CAPS', 'IMPORT');
// New: 1.3
DEFINE ('_UDDEADM_MOOTOOLS_HEAD', 'Load MooTools');
DEFINE ('_UDDEADM_MOOTOOLS_EXP', 'This specifies how uddeIM loads MooTools (MooTools is required for Autocompleter): <i>None</i> is useful when your template loads MooTools, <i>Auto</i> is the recommended default (same behavior as in uddeIM 1.2), when using J1.0 you can also force loading MooTools 1.1 or 1.2.');
DEFINE ('_UDDEADM_MOOTOOLS_NONE', 'do not load MooTools');
DEFINE ('_UDDEADM_MOOTOOLS_AUTO', 'auto');
DEFINE ('_UDDEADM_MOOTOOLS_1', 'force loading MooTools 1.1');
DEFINE ('_UDDEADM_MOOTOOLS_2', 'force loading MooTools 1.2');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING_1', '...setting default for MooTools');
DEFINE ('_UDDEADM_AGORA', 'Agora');
// New: 1.2
DEFINE ('_UDDEADM_CRYPT3', 'Base64 encoded');
DEFINE ('_UDDEADM_TIMEZONE_HEAD', 'Adjust timezone');
DEFINE ('_UDDEADM_TIMEZONE_EXP', 'When uddeIM shows the wrong time you can adjust the timezone setting here. Usually, when everything is configured correctly, this should be zero. Nevertheless there might be cases you need to change this value.');
DEFINE ('_UDDEADM_HOURS', 'hours');
DEFINE ('_UDDEADM_VERSIONCHECK', 'Version information:');
DEFINE ('_UDDEADM_STATISTICS', 'Statistics:');
DEFINE ('_UDDEADM_STATISTICS_HEAD', 'Show statistics');
DEFINE ('_UDDEADM_STATISTICS_EXP', 'This displays some statistics like number of stored messages etc.');
DEFINE ('_UDDEADM_STATISTICS_CHECK', 'SHOW STATISTICS');
DEFINE ('_UDDEADM_MAINTENANCE_COUNT', 'Messages stored in database: ');
DEFINE ('_UDDEADM_MAINTENANCE_COUNT_RECIPIENT', 'Messages trashed by recipient: ');
DEFINE ('_UDDEADM_MAINTENANCE_COUNT_SENDER', 'Messages trashed by sender: ');
DEFINE ('_UDDEADM_MAINTENANCE_COUNT_TRASH', 'Messages on hold for purging: ');
DEFINE ('_UDDEADM_OVERWRITEITEMID_HEAD', 'Overwrite Itemid');
DEFINE ('_UDDEADM_OVERWRITEITEMID_EXP', 'Usually uddeIM tries to detect the correct Itemid when it is not set. In some cases it might be necessary to overwrite this value, e.g. when you use several menu links to uddeIM.');
DEFINE ('_UDDEADM_OVERWRITEITEMID_CURRENT', 'Detected Itemid is: ');
DEFINE ('_UDDEADM_USEITEMID_HEAD', 'Use Itemid');
DEFINE ('_UDDEADM_USEITEMID_EXP', 'Use this Itemid instead of the detected one.');
DEFINE ('_UDDEADM_SHOWLINK_HEAD', 'Use profile links');
DEFINE ('_UDDEADM_SHOWLINK_EXP', 'When set to <i>yes</i>, all usernames showing up in uddeIM will be displayed as links to the user profile.');
DEFINE ('_UDDEADM_SHOWPIC_HEAD', 'Show thumbnails');
DEFINE ('_UDDEADM_SHOWPIC_EXP', 'When set to <i>yes</i>, the thumbnail of the respective user will be displayed when reading a message.');
DEFINE ('_UDDEADM_THUMBLISTS_HEAD', 'Show thumbnails in lists');
DEFINE ('_UDDEADM_THUMBLISTS_EXP', 'Set to <i>yes</i> if you want to display thumbnails of users in the message lists overview (inbox, outbox, etc.)');
DEFINE ('_UDDEADM_FIREBOARD', 'Fireboard');
DEFINE ('_UDDEADM_CB', 'Community Builder');
DEFINE ('_UDDEADM_DISABLED', 'Disabled');
DEFINE ('_UDDEADM_ENABLED', 'Enabled');
DEFINE ('_UDDEIM_STATUS_FLAGGED', 'Quan trọng');
DEFINE ('_UDDEIM_STATUS_UNFLAGGED', '');
DEFINE ('_UDDEADM_ALLOWFLAGGED_HEAD', 'Allow message tagging');
DEFINE ('_UDDEADM_ALLOWFLAGGED_EXP', 'Allows message tagging (uddeIM shows a star in lists which can be highlighted to mark important messages).');
DEFINE ('_UDDEADM_REVIEWUPDATE', 'Important: When you have upgraded uddeIM from an earlier version please check the README. Sometimes you have to add or change database tables or fields!');
DEFINE ('_UDDEIM_ADDCCINFO', 'Thêm đồng gửi');
DEFINE ('_UDDEIM_CC', 'Đồng gửi:');
DEFINE ('_UDDEADM_TRUNCATE_HEAD', 'Truncate quoted text');
DEFINE ('_UDDEADM_TRUNCATE_EXP', 'Truncate quoted text to 2/3 of the maximum text length if it exceeds this limit.');
DEFINE ('_UDDEIM_PLUG_INBOXENTRIES', 'Thư đến ');
DEFINE ('_UDDEIM_PLUG_LAST', 'Tiếp ');
DEFINE ('_UDDEIM_PLUG_ENTRIES', ' thư');
DEFINE ('_UDDEIM_PLUG_STATUS', 'Tình trạng');
DEFINE ('_UDDEIM_PLUG_SENDER', 'Người gửi');
DEFINE ('_UDDEIM_PLUG_MESSAGE', 'Tin nhắn');
DEFINE ('_UDDEIM_PLUG_EMPTYINBOX', 'Xóa hết');
// New: 1.1
DEFINE ('_UDDEADM_NOTRASHACCESS_NOT', 'Access to trashcan not allowed.');
DEFINE ('_UDDEADM_NOTRASHACCESS_HEAD', 'Restrict trashcan access');
DEFINE ('_UDDEADM_NOTRASHACCESS_EXP', 'You can restrict the access to the trashcan. Usually the trashcan is available for all (<i>no restriction</i>). You can restrict the access to special users or to admins only, so groups with lower access rights cannot recycle a message.');
DEFINE ('_UDDEADM_NOTRASHACCESS_0', 'no restriction');
DEFINE ('_UDDEADM_NOTRASHACCESS_1', 'special users');
DEFINE ('_UDDEADM_NOTRASHACCESS_2', 'admins only');
DEFINE ('_UDDEADM_PUBHIDEUSERS_HEAD', 'Hide users from userlist');
DEFINE ('_UDDEADM_PUBHIDEUSERS_EXP', 'Enter user IDs which should be hidden from public userlist (e.g. 65,66,67).');
DEFINE ('_UDDEADM_HIDEUSERS_HEAD', 'Hide users from userlist');
DEFINE ('_UDDEADM_HIDEUSERS_EXP', 'Enter user IDs which should be hidden from userlist (e.g. 65,66,67). Admins will always see the complete list.');
DEFINE ('_UDDEIM_ERRORCSRF', 'CSRF attack recognized');
DEFINE ('_UDDEADM_CSRFPROTECTION_HEAD', 'CSRF protection');
DEFINE ('_UDDEADM_CSRFPROTECTION_EXP', 'This protects all forms against Cross-Site Request Forgery attacks. Usually this should be enabled. Only when you have strange problems switch it off.');
DEFINE ('_UDDEIM_CANTREPLYARCHIVE', 'Bạn không thể trả lời tin nhắn lưu trữ.');
DEFINE ('_UDDEIM_COULDNOTRECALLPUBLIC', 'Không thể khôi phục tin nhắn trả lời tới thành viên chưa đăng kí.');
DEFINE ('_UDDEADM_PUBREPLYS_HEAD', 'Allow replies');
DEFINE ('_UDDEADM_PUBREPLYS_EXP', 'Allow direct replies to messages from public users.');
DEFINE ('_UDDEIM_EMN_BODY_PUBLICWITHMESSAGE',
"Chào %user%,\n\n%you% đã gửi tin nhắn cho bạn tại %site%.\n__________________\n%pmessage%");
DEFINE ('_UDDEADM_PUBNAMESTEXT', 'Show realnames');
DEFINE ('_UDDEADM_PUBNAMESDESC', 'Show realnames or usernames in public frontend?');
DEFINE ('_UDDEIM_USERLIST', 'Danh sách');
DEFINE ('_UDDEIM_YOUHAVETOWAIT', 'Xin lỗi, bạn phải chờ trước khi có thể gửi tin nhắn tiếp theo');
DEFINE ('_UDDEADM_USERSET_LASTSENT', 'Last sent');
DEFINE ('_UDDEADM_TIMEDELAY_HEAD', 'Timedelay');
DEFINE ('_UDDEADM_TIMEDELAY_EXP', 'Time in seconds a user must wait before he can post the next message (0 for no time delay).');
DEFINE ('_UDDEADM_SECONDS', 'seconds');
DEFINE ('_UDDEIM_PUBLICSENT', 'Đã gửi tin nhắn.');
DEFINE ('_UDDEIM_ERRORINFROMNAME', 'Sai tên người gửi');
DEFINE ('_UDDEIM_ERRORINEMAIL', 'Sai địa chỉ email');
DEFINE ('_UDDEIM_YOURNAME', 'Tên bạn:');
DEFINE ('_UDDEIM_YOUREMAIL', 'Email:');
DEFINE ('_UDDEADM_VERSIONCHECK_USING', 'You are using uddeIM ');
DEFINE ('_UDDEADM_VERSIONCHECK_LATEST', 'You are already using the latest version of uddeIM.');
DEFINE ('_UDDEADM_VERSIONCHECK_CURRENT', 'The current version is ');
DEFINE ('_UDDEADM_VERSIONCHECK_INFO', 'Update information:');
DEFINE ('_UDDEADM_VERSIONCHECK_HEAD', 'Check for updates');
DEFINE ('_UDDEADM_VERSIONCHECK_EXP', 'This contacts uddeIM developer website to receive information about the current uddeIM version.');
DEFINE ('_UDDEADM_VERSIONCHECK_CHECK', 'CHECK NOW');
DEFINE ('_UDDEADM_VERSIONCHECK_ERROR', 'Unable to receive version information.');
DEFINE ('_UDDEIM_NOSUCHLIST', 'Không tìm thấy nhóm liên lạc!');
DEFINE ('_UDDEIM_LISTSLIMIT_1', 'Vượt quá số người nhận (Tối đa: ');
DEFINE ('_UDDEADM_MAXONLISTS_HEAD', 'Max. number of entries');
DEFINE ('_UDDEADM_MAXONLISTS_EXP', 'Max. number of entries allowed per contact list.');
DEFINE ('_UDDEIM_LISTSNOTENABLED', 'Không cho phép sử dụng nhóm liên lạc');
DEFINE ('_UDDEADM_ENABLELISTS_HEAD', 'Enable contact lists');
DEFINE ('_UDDEADM_ENABLELISTS_EXP', 'uddeIM allows users to create contact lists. These lists can be used to send messages to multiple users. Do not forget to enable multiple recipients when you want to use contact lists.');
DEFINE ('_UDDEADM_ENABLELISTS_0', 'disabled');
DEFINE ('_UDDEADM_ENABLELISTS_1', 'registered users');
DEFINE ('_UDDEADM_ENABLELISTS_2', 'special users');
DEFINE ('_UDDEADM_ENABLELISTS_3', 'admins only');
DEFINE ('_UDDEIM_LISTSNEW', 'Tạo danh sách liên lạc mới');
DEFINE ('_UDDEIM_LISTSSAVED', 'Đã lưu nhóm liên lạc');
DEFINE ('_UDDEIM_LISTSUPDATED', 'Đã cập nhật nhóm liên lạc');
DEFINE ('_UDDEIM_LISTSDESC', 'Mô tả');
DEFINE ('_UDDEIM_LISTSNAME', 'Tên nhóm');
DEFINE ('_UDDEIM_LISTSNAMEWO', 'Tên nhóm(không dấu cách)');
DEFINE ('_UDDEIM_EDITLINK', 'Sửa');
DEFINE ('_UDDEIM_LISTS', 'Liên lạc');
DEFINE ('_UDDEIM_STATUS_READ', 'Đã đọc');
DEFINE ('_UDDEIM_STATUS_UNREAD', 'Chưa đọc');
DEFINE ('_UDDEIM_STATUS_ONLINE', 'Online');
DEFINE ('_UDDEIM_STATUS_OFFLINE', 'Offline');
DEFINE ('_UDDEADM_CBGALLERY_HEAD', 'Show CB gallery pictures');
DEFINE ('_UDDEADM_CBGALLERY_EXP', 'By default uddeIM does only show avatars users have uploaded. When you enable this setting uddeIM does also display pictures from the CB avatars gallery.');
DEFINE ('_UDDEADM_UNBLOCKCB_HEAD', 'Unblock CB connections');
DEFINE ('_UDDEADM_UNBLOCKCB_EXP', 'You can allow messages to recipients when the registered user is on the recipients CB connection list (even when the recipient is in a group which is blocked). This setting is independent from the individual blocking each user can configure when enabled (see settings above).');
DEFINE ('_UDDEIM_GROUPBLOCKED', 'Bạn không được phép gửi tin nhắn tới nhóm này.');
DEFINE ('_UDDEIM_ONEUSERBLOCKS', 'Người nhận đã khóa nick bạn.');
DEFINE ('_UDDEADM_BLOCKGROUPS_HEAD', 'Blocked groups (registered users)');
DEFINE ('_UDDEADM_BLOCKGROUPS_EXP', 'Groups to which registered users are not allowed to send messages to. This is for registered users only. Special users and admins are not affected by this setting. This setting is independent from the individual blocking each user can configure when enabled (see settings above).');
DEFINE ('_UDDEADM_PUBBLOCKGROUPS_HEAD', 'Blocked groups (public users)');
DEFINE ('_UDDEADM_PUBBLOCKGROUPS_EXP', 'Groups to which public users are not allowed to send messages to. This setting is independent from the individual blocking each user can configure when enabled (see settings above). When you block a group, users in this group cannot see the the option to enable the public frontend in their profile settings.');
DEFINE ('_UDDEADM_BLOCKGROUPS_1', 'Public user');
DEFINE ('_UDDEADM_BLOCKGROUPS_2', 'CB connection');
DEFINE ('_UDDEADM_BLOCKGROUPS_18', 'Registered user');
DEFINE ('_UDDEADM_BLOCKGROUPS_19', 'Author');
DEFINE ('_UDDEADM_BLOCKGROUPS_20', 'Editor');
DEFINE ('_UDDEADM_BLOCKGROUPS_21', 'Publisher');
DEFINE ('_UDDEADM_BLOCKGROUPS_23', 'Manager');
DEFINE ('_UDDEADM_BLOCKGROUPS_24', 'Admin');
DEFINE ('_UDDEADM_BLOCKGROUPS_25', 'SuperAdmin');
DEFINE ('_UDDEIM_NOPUBLICMSG', 'Người dùng chỉ chấp nhận tin nhắn từ các thành viên đã đăng kí.');
DEFINE ('_UDDEADM_PUBHIDEALLUSERS_HEAD', 'Hide from public "All users" list');
DEFINE ('_UDDEADM_PUBHIDEALLUSERS_EXP', 'You can hide certain groups to be listed in the public "All users" list. Note: this hides the names only, the users can still receive messages. Users who have not enabled Public Frontend will never be listed in this list.');
DEFINE ('_UDDEADM_HIDEALLUSERS_HEAD', 'Hide from "All users" list');
DEFINE ('_UDDEADM_HIDEALLUSERS_EXP', 'You can hide certain groups to be listed in the "All users" list. Note: this hides the names only, the users can still receive messages.');
DEFINE ('_UDDEADM_HIDEALLUSERS_0', 'none');
DEFINE ('_UDDEADM_HIDEALLUSERS_1', 'superadmins only');
DEFINE ('_UDDEADM_HIDEALLUSERS_2', 'admins only');
DEFINE ('_UDDEADM_HIDEALLUSERS_3', 'special users');
DEFINE ('_UDDEADM_PUBLIC', 'Public');
DEFINE ('_UDDEADM_PUBMODESHOWALLUSERS_HEAD', 'Behavior of "All users" link');
DEFINE ('_UDDEADM_PUBMODESHOWALLUSERS_EXP', 'Choose if the "All users" link should be suppressed in Public Frontend, displayed or if always all users should be shown.');
DEFINE ('_UDDEADM_USERSET_PUBLIC', 'Public Frontend');
DEFINE ('_UDDEADM_USERSET_SELPUBLIC', '- select public -');
DEFINE ('_UDDEIM_OPTIONS_F', 'Cho phép khách gửi tin nhắn');
DEFINE ('_UDDEIM_MSGLIMITREACHED', 'Vượt quá giới hạn tin nhắn!');
DEFINE ('_UDDEIM_PUBLICUSER', 'Khách');
DEFINE ('_UDDEIM_DELETEDUSER', 'Đã xóa thành viên');
DEFINE ('_UDDEADM_CAPTCHALEN_HEAD', 'Captcha length');
DEFINE ('_UDDEADM_CAPTCHALEN_EXP', 'Specifies how many characters a user must enter.');
DEFINE ('_UDDEADM_USECAPTCHA_HEAD', 'Captcha spam protection');
DEFINE ('_UDDEADM_USECAPTCHA_EXP', 'Specify who has to enter a captcha when sending a message');
DEFINE ('_UDDEADM_CAPTCHAF0', 'disabled');
DEFINE ('_UDDEADM_CAPTCHAF1', 'public users only');
DEFINE ('_UDDEADM_CAPTCHAF2', 'public and registered users');
DEFINE ('_UDDEADM_CAPTCHAF3', 'public, registered, special users');
DEFINE ('_UDDEADM_CAPTCHAF4', 'all users (incl. admins)');
DEFINE ('_UDDEADM_PUBFRONTEND_HEAD', 'Enable public frontend');
DEFINE ('_UDDEADM_PUBFRONTEND_EXP', 'When enabled public users can send messages to your registered users (those can specify in their personal settings if they want to use this feature).');
DEFINE ('_UDDEADM_PUBFRONTENDDEF_HEAD', 'Public frontend default');
DEFINE ('_UDDEADM_PUBFRONTENDDEF_EXP', 'This is the default value if a public user is allowed to send a message to a registered user.');
DEFINE ('_UDDEADM_PUBDEF0', 'disabled');
DEFINE ('_UDDEADM_PUBDEF1', 'enabled');
DEFINE ('_UDDEIM_WRONGCAPTCHA', 'Sai mã bảo vệ');
// New: 1.0
DEFINE ('_UDDEADM_NONEORUNKNOWN', 'none or unknown');
DEFINE ('_UDDEADM_DONATE', 'If you like uddeIM and want to support the development please make a small donation.');
// New: 1.0rc2
DEFINE ('_UDDEADM_BACKUPRESTORE_DATE', 'Configuration found in database: ');
DEFINE ('_UDDEADM_BACKUPRESTORE_HEAD', 'Backup and restore configuration');
DEFINE ('_UDDEADM_BACKUPRESTORE_EXP', 'You can backup your configuration to the database and restore it when necessary. This is useful when you update uddeIM or when you want to save a certain configuration because of testing.');
DEFINE ('_UDDEADM_BACKUPRESTORE_BACKUP', 'BACKUP');
DEFINE ('_UDDEADM_BACKUPRESTORE_RESTORE', 'RESTORE');
DEFINE ('_UDDEADM_CANCEL', 'Cancel');
// New: 1.0rc1
DEFINE ('_UDDEADM_LANGUAGECHARSET_HEAD', 'Language file character set');
DEFINE ('_UDDEADM_LANGUAGECHARSET_EXP', 'Usually <b>default</b> (ISO-8859-1) is the correct setting for Joomla 1.0 and <b>UTF-8</b> for Joomla 1.5.');
DEFINE ('_UDDEADM_LANGUAGECHARSET_UTF8', 'UTF-8');
DEFINE ('_UDDEADM_LANGUAGECHARSET_DEFAULT', 'default');
DEFINE ('_UDDEIM_READ_INFO_1', 'Tin nhắn đã đọc sẽ ở trong hộp thư đến trong vòng tối đa ');
DEFINE ('_UDDEIM_READ_INFO_2', ' ngày trước khi tự động bị xóa.');
DEFINE ('_UDDEIM_UNREAD_INFO_1', 'Tin nhắn chưa đọc sẽ ở trong hộp thư đến trong vòng tối đa ');
DEFINE ('_UDDEIM_UNREAD_INFO_2', ' ngày trước khi tự động bị xóa.');
DEFINE ('_UDDEIM_SENT_INFO_1', 'Tin nhắn gửi đi sẽ ở trong hộp thư đi trong vòng tối đa ');
DEFINE ('_UDDEIM_SENT_INFO_2', ' ngày trước khi tự động bị xóa.');
DEFINE ('_UDDEADM_DELETEREADAFTERNOTE_HEAD', 'Show inbox note for read messages');
DEFINE ('_UDDEADM_DELETEREADAFTERNOTE_EXP', 'Show inbox note <i>"Read messages will be deleted after n days"</i>');
DEFINE ('_UDDEADM_DELETEUNREADAFTERNOTE_HEAD', 'Show inbox note for unread messages');
DEFINE ('_UDDEADM_DELETEUNREADAFTERNOTE_EXP', 'Show inbox note <i>"Unread messages will be deleted after n days"</i>');
DEFINE ('_UDDEADM_DELETESENTAFTERNOTE_HEAD', 'Show outbox note for sent messages');
DEFINE ('_UDDEADM_DELETESENTAFTERNOTE_EXP', 'Show outbox note <i>"Sent messages will be deleted after n days"</i>');
DEFINE ('_UDDEADM_DELETETRASHAFTERNOTE_HEAD', 'Show trashcan note for trashed messages');
DEFINE ('_UDDEADM_DELETETRASHAFTERNOTE_EXP', 'Show trashcan note <i>"Trashed messages will be purged after n days"</i>');
DEFINE ('_UDDEADM_DELETESENTAFTER_HEAD', 'Sent messages kept for (days)');
DEFINE ('_UDDEADM_DELETESENTAFTER_EXP', 'Enter the number of days until <b>sent</b> messages will automatically be erased from the outbox.');
DEFINE ('_UDDEIM_SEND_TOALLSPECIAL', 'Gửi tới nhóm thành viên đặc biệt');
DEFINE ('_UDDEIM_SYSGM_WILLSENDTOALLSPECIAL', 'Tin nhắn tới <b>tất cả các thành viên đặc biệt</b>');
DEFINE ('_UDDEADM_USERSET_SELUSERNAME', '- select username -');
DEFINE ('_UDDEADM_USERSET_SELNAME', '- select name -');
DEFINE ('_UDDEADM_USERSET_EDITSETTINGS', 'Edit user settings');
DEFINE ('_UDDEADM_USERSET_EXISTING', 'existing');
DEFINE ('_UDDEADM_USERSET_NONEXISTING', 'non existing');
DEFINE ('_UDDEADM_USERSET_SELENTRY', '- select entry -');
DEFINE ('_UDDEADM_USERSET_SELNOTIFICATION', '- select notification -');
DEFINE ('_UDDEADM_USERSET_SELPOPUP', '- select popup -');
DEFINE ('_UDDEADM_USERSET_USERNAME', 'Username');
DEFINE ('_UDDEADM_USERSET_NAME', 'Name');
DEFINE ('_UDDEADM_USERSET_NOTIFICATION', 'Notification');
DEFINE ('_UDDEADM_USERSET_POPUP', 'Popup');
DEFINE ('_UDDEADM_USERSET_LASTACCESS', 'Last access');
DEFINE ('_UDDEADM_USERSET_NO', 'No');
DEFINE ('_UDDEADM_USERSET_YES', 'Yes');
DEFINE ('_UDDEADM_USERSET_UNKNOWN', 'unknown');
DEFINE ('_UDDEADM_USERSET_WHENOFFLINEEXCEPT', 'When offline (except replies)');
DEFINE ('_UDDEADM_USERSET_ALWAYSEXCEPT', 'Always (except replies)');
DEFINE ('_UDDEADM_USERSET_WHENOFFLINE', 'When offline');
DEFINE ('_UDDEADM_USERSET_ALWAYS', 'Always');
DEFINE ('_UDDEADM_USERSET_NONOTIFICATION', 'No notification');
DEFINE ('_UDDEADM_WELCOMEMSG', "Welcome to uddeIM!\n\nYou have succesfully installed uddeIM.\n\nTry viewing this message with different templates. You can set them in the administration backend of uddeIM.\n\nuddeIM is a project in development. If you find bugs or weaknesses, please write them to me so that we can make uddeIM better together.\n\nGood luck and have fun!");
DEFINE ('_UDDEADM_UDDEINSTCOMPLETE', 'uddeIM installation complete.');
DEFINE ('_UDDEADM_REVIEWSETTINGS', 'Please continue to the administration backend and review the settings.');
DEFINE ('_UDDEADM_REVIEWLANG', 'If you are running the CMS in a character set other than ISO 8859-1 make sure to adjust the settings accordingly.');
DEFINE ('_UDDEADM_REVIEWEMAILSTOP', 'After installation, all uddeIM e-mail traffic (e-mail notifications, fotgetmenot e-mails) is disabled so that no e-mails are sent as long as you are testing. Do not forget to disable "stop e-mail" in the backend when you are finished.');
DEFINE ('_UDDEADM_MAXRECIPIENTS_HEAD', 'Max. recipients');
DEFINE ('_UDDEADM_MAXRECIPIENTS_EXP', 'Max. number of recipients which are allowed per message (0=no limitation)');
DEFINE ('_UDDEIM_TOOMANYRECIPIENTS', 'Quá nhiều người nhận');
DEFINE ('_UDDEIM_STOPPEDEMAIL', 'Không thể gửi email.');
DEFINE ('_UDDEADM_SEARCHINSTRING_HEAD', 'Inside text searching');
DEFINE ('_UDDEADM_SEARCHINSTRING_EXP', 'Autocompleter searches inside the text (otherwise it searches from the beginning only)');
DEFINE ('_UDDEADM_MODESHOWALLUSERS_HEAD', 'Behavior of "All users" link');
DEFINE ('_UDDEADM_MODESHOWALLUSERS_EXP', 'Choose if the "All users" link should be suppressed, displayed or if always all users should be shown.');
DEFINE ('_UDDEADM_MODESHOWALLUSERS_0', 'Suppress "All Users" link');
DEFINE ('_UDDEADM_MODESHOWALLUSERS_1', 'Show "All Users" link');
DEFINE ('_UDDEADM_MODESHOWALLUSERS_2', 'Always show all users');
DEFINE ('_UDDEADM_CONFIGNOTWRITEABLE', 'Configuration is not writeable:');
DEFINE ('_UDDEADM_CONFIGWRITEABLE', 'Configuration is writeable:');
DEFINE ('_UDDEIM_FORWARDLINK', 'Chuyển tiếp');
DEFINE ('_UDDEIM_RECIPIENTFOUND', 'người nhận');
DEFINE ('_UDDEIM_RECIPIENTSFOUND', 'người nhận');
DEFINE ('_UDDEADM_MAILSYSTEM_MOSMAIL', 'mosMail');
DEFINE ('_UDDEADM_MAILSYSTEM_PHPMAIL', 'php mail (default)');
DEFINE ('_UDDEADM_MAILSYSTEM_HEAD', 'Mailsystem');
DEFINE ('_UDDEADM_MAILSYSTEM_EXP', 'Select mailsystem uddeIM should use to send notifications.');
DEFINE ('_UDDEADM_SHOWGROUPS_HEAD', 'Show Joomla groups');
DEFINE ('_UDDEADM_SHOWGROUPS_EXP', 'Show Joomla groups in general message list.');
DEFINE ('_UDDEADM_ALLOWFORWARDS_HEAD', 'Forwarding of messages');
DEFINE ('_UDDEADM_ALLOWFORWARDS_EXP', 'Allow forwarding of messages.');
DEFINE ('_UDDEIM_FWDFROM', 'Tin nhắn gốc từ');
DEFINE ('_UDDEIM_FWDTO', 'chuyển tiếp tới');
// New: 0.9+
DEFINE ('_UDDEIM_UNARCHIVE', 'Hủy lưu trữ');
DEFINE ('_UDDEIM_CANTUNARCHIVE', 'Không thể hủy lưu trữ tin nhắn');
DEFINE ('_UDDEADM_ALLOWMULTIPLERECIPIENTS_HEAD', 'Allow multiple recipients');
DEFINE ('_UDDEADM_ALLOWMULTIPLERECIPIENTS_EXP', 'Allow multiple recipients (comma separated).');
DEFINE ('_UDDEIM_CHARSLEFT', 'kí tự còn lại');
DEFINE ('_UDDEADM_SHOWTEXTCOUNTER_HEAD', 'Show text counter');
DEFINE ('_UDDEADM_SHOWTEXTCOUNTER_EXP', 'Shows a text counter which displays how many characters are left.');
DEFINE ('_UDDEIM_CLEAR', 'Xóa hết');
DEFINE ('_UDDEADM_ALLOWMULTIPLEUSER_HEAD', 'Append selected users to recipients');
DEFINE ('_UDDEADM_ALLOWMULTIPLEUSER_EXP', 'This allows selection of multiple recipients from "All users" list.');
DEFINE ('_UDDEADM_CBALLOWMULTIPLEUSER_HEAD', 'Append selected connections to recipients');
DEFINE ('_UDDEADM_CBALLOWMULTIPLEUSER_EXP', 'This allows selection of multiple recipients from "CB connections" list.');
DEFINE ('_UDDEADM_PMSFOUND', 'PMS found: ');
DEFINE ('_UDDEIM_ENTERNAME', 'Chưa nhập tên');
DEFINE ('_UDDEADM_USEAUTOCOMPLETE_HEAD', 'Use autocomplete');
DEFINE ('_UDDEADM_USEAUTOCOMPLETE_EXP', 'Use autocomplete for receiver names.');
DEFINE ('_UDDEADM_OBFUSCATING_HEAD', 'Key used for obfuscating');
DEFINE ('_UDDEADM_OBFUSCATING_EXP', 'Enter key which is used for message obfuscating. Do not change this value after message obfuscating has been enabled.');
DEFINE ('_UDDEADM_CFGFILE_NOTFOUND', 'Wrong confguration file found!');
DEFINE ('_UDDEADM_CFGFILE_FOUND', 'Version found:');
DEFINE ('_UDDEADM_CFGFILE_EXPECTED', 'Version expected:');
DEFINE ('_UDDEADM_CFGFILE_CONVERTING', 'Converting configuration...');
DEFINE ('_UDDEADM_CFGFILE_DONE', 'Done!');
DEFINE ('_UDDEADM_CFGFILE_WRITEFAILED', 'Critical Error: Failed to write to configuration file:');
// New: 0.8+
DEFINE ('_UDDEIM_ENCRYPTDOWN', 'Tin nhắn đã bị mã hóa! - Không thể download!');
DEFINE ('_UDDEIM_WRONGPASSDOWN', 'Sai mật khẩu! - Không thể download!');
DEFINE ('_UDDEIM_WRONGPW', 'Sai mật khẩu! - Vui lòng liên hệ với admin!');
DEFINE ('_UDDEIM_WRONGPASS', 'Sai mật khẩu!');
DEFINE ('_UDDEADM_MAINTENANCE_D1', 'Wrong trash dates (inbox/outbox): ');
DEFINE ('_UDDEADM_MAINTENANCE_D2', 'Correcting wrong trash dates');
DEFINE ('_UDDEIM_TODP', 'Gửi tới: ');
DEFINE ('_UDDEADM_MAINTENANCE_PRUNE', 'Prune messages now');
DEFINE ('_UDDEADM_SHOWACTIONICONS_HEAD', 'Show action icons');
DEFINE ('_UDDEADM_SHOWACTIONICONS_EXP', 'When set to <b>yes</b>, action links will be displayed with an icon.');
DEFINE ('_UDDEIM_UNCHECKALL', 'Bỏ chọn');
DEFINE ('_UDDEIM_CHECKALL', 'Chọn tất cả');
DEFINE ('_UDDEADM_SHOWBOTTOMICONS_HEAD', 'Show bottom icons');
DEFINE ('_UDDEADM_SHOWBOTTOMICONS_EXP', 'When set to <b>yes</b>, bottom links will be displayed with an icon.');
DEFINE ('_UDDEADM_ANIMATED_HEAD', 'Use animated smileys');
DEFINE ('_UDDEADM_ANIMATED_EXP', 'Use animated smileys instead of the static ones.');
DEFINE ('_UDDEADM_ANIMATEDEX_HEAD', 'More animated smileys');
DEFINE ('_UDDEADM_ANIMATEDEX_EXP', 'Show more animated smileys.');
DEFINE ('_UDDEIM_PASSWORDREQ', 'Tin nhắn đã bị mã hóa - Yêu cầu mật khẩu');
DEFINE ('_UDDEIM_PASSWORD', '<b>Yêu cầu mật khẩu</b>');
DEFINE ('_UDDEIM_PASSWORDBOX', 'Mật khẩu');
DEFINE ('_UDDEIM_ENCRYPTIONTEXT', ' (nội dung mã hóa)');
DEFINE ('_UDDEIM_DECRYPTIONTEXT', ' (nội dung giải mã)');
DEFINE ('_UDDEIM_MORE', 'Thêm');
// uddeIM Module
DEFINE ('_UDDEMODULE_PRIVATEMESSAGES', 'Tin nhắn');
DEFINE ('_UDDEMODULE_NONEW', 'không mới');
DEFINE ('_UDDEMODULE_NEWMESSAGES', 'Tin nhắn mới: ');
DEFINE ('_UDDEMODULE_MESSAGE', 'tin nhắn');
DEFINE ('_UDDEMODULE_MESSAGES', 'tin nhắn');
DEFINE ('_UDDEMODULE_YOUHAVE', 'Bạn có');
DEFINE ('_UDDEMODULE_HELLO', 'Hi');
DEFINE ('_UDDEMODULE_EXPRESSMESSAGE', 'Tin nhắn nhanh');
// New: 0.7+
DEFINE ('_UDDEADM_USEENCRYPTION', 'Use encryption');
DEFINE ('_UDDEADM_USEENCRYPTIONDESC', 'Encrypt stored messages');
DEFINE ('_UDDEADM_CRYPT0', 'None');
DEFINE ('_UDDEADM_CRYPT1', 'Obfuscate messages');
DEFINE ('_UDDEADM_CRYPT2', 'Encrypt messages');
DEFINE ('_UDDEADM_NOTIFYDEFAULT_HEAD', 'Default for e-mail notification');
DEFINE ('_UDDEADM_NOTIFYDEFAULT_EXP', 'Default value for e-mail notification (for users who have not changed their preferences yet).');
DEFINE ('_UDDEADM_NOTIFYDEF_0', 'No notification');
DEFINE ('_UDDEADM_NOTIFYDEF_1', 'Always');
DEFINE ('_UDDEADM_NOTIFYDEF_2', 'Notification when offline');
DEFINE ('_UDDEADM_SUPPRESSALLUSERS_HEAD', 'Supress "All users" link');
DEFINE ('_UDDEADM_SUPPRESSALLUSERS_EXP', 'Supress "All users" link in write new message box (useful when lots of users are registered).');
DEFINE ('_UDDEADM_POPUP_HEAD','Popup notification');
DEFINE ('_UDDEADM_POPUP_EXP','Show a popup when a new message arrives (mod_uddeim or patched mod_cblogin is needed)');
DEFINE ('_UDDEIM_OPTIONS', 'Thiết lập khác');
DEFINE ('_UDDEIM_OPTIONS_EXP', 'Bạn có thể tùy biến các thiết lập khác tại đây.');
DEFINE ('_UDDEIM_OPTIONS_P', 'Hiện popup khi có tin nhắn mới');
DEFINE ('_UDDEADM_POPUPDEFAULT_HEAD', 'Popup notification by default');
DEFINE ('_UDDEADM_POPUPDEFAULT_EXP', 'Enable popup notification by default (for users who have not changed their preferences yet).');
DEFINE ('_UDDEADM_MAINTENANCE', 'Maintenance');
DEFINE ('_UDDEADM_MAINTENANCE_HEAD', 'Database maintenance');
DEFINE ('_UDDEADM_MAINTENANCE_CHECK', 'CHECK');
DEFINE ('_UDDEADM_MAINTENANCE_TRASH', 'REPAIR');
DEFINE ('_UDDEADM_MAINTENANCE_EXP', "When a user is purged from the database his messages are usually kept in the database. This function checks if it is necessary to trash orphaned messages and you can trash them if it is required.<br />This also checks the database for a few errors which will be corrected.");
DEFINE ('_UDDEADM_MAINTENANCE_MC1', "Checking...<br />");
DEFINE ('_UDDEADM_MAINTENANCE_MC2', "<i>#nnn (Username): [inbox|inbox trashed|outbox|outbox trashed]</i><br />");
DEFINE ('_UDDEADM_MAINTENANCE_MC3', "<i>inbox: messages stored in users inbox</i><br />");
DEFINE ('_UDDEADM_MAINTENANCE_MC4', "<i>inbox trashed: messages trashed from users inbox, but still in someones outbox</i><br />");
DEFINE ('_UDDEADM_MAINTENANCE_MC5', "<i>outbox: messages stored in users outbox</i><br />");
DEFINE ('_UDDEADM_MAINTENANCE_MC6', "<i>outbox trashed: messages trashed from users outbox, but still in someones inbox</i><br />");
DEFINE ('_UDDEADM_MAINTENANCE_MT1', "Trashing...<br />");
DEFINE ('_UDDEADM_MAINTENANCE_NOTFOUND', "not found (from/to/settings/blocker/blocked):");
DEFINE ('_UDDEADM_MAINTENANCE_MT2', "delete all preferences from user");
DEFINE ('_UDDEADM_MAINTENANCE_MT3', "delete blocking of user");
DEFINE ('_UDDEADM_MAINTENANCE_MT4', "trash all messages sent to deleted user in sender\'s outbox and deleted user\'s inbox");
DEFINE ('_UDDEADM_MAINTENANCE_MT5', "trash all messages sent from deleted user in his outbox and receiver\'s inbox");
DEFINE ('_UDDEADM_MAINTENANCE_NOTHINGTODO', '<b>Nothing to do</b><br />');
DEFINE ('_UDDEADM_MAINTENANCE_JOBTODO', '<b>Maintenance required</b><br />');
// New: 0.6+
DEFINE ('_UDDEADM_NAMESTEXT', 'Show realnames');
DEFINE ('_UDDEADM_NAMESDESC', 'Show realnames or usernames?');
DEFINE ('_UDDEADM_REALNAMES', 'Realnames');
DEFINE ('_UDDEADM_USERNAMES', 'Usernames');
DEFINE ('_UDDEADM_CONLISTBOX', 'Connections listbox');
DEFINE ('_UDDEADM_CONLISTBOXDESC', 'Show my connections in a listbox or in a table?');
DEFINE ('_UDDEADM_LISTBOX', 'Listbox');
DEFINE ('_UDDEADM_TABLE', 'Table');
DEFINE ('_UDDEIM_TRASHCAN_INFO', 'Tin nhắn sẽ ở trong thùng rác 24 giờ trước khi bị xóa vĩnh viễn. Bạn chỉ có thể xem những từ đầu tiên cảu tin nhắn. Để đọc được tin nhắn, bạn phải khôi phục lại nó.');
DEFINE ('_UDDEIM_TRASHCAN_INFO_1', 'Tin nhắn sẽ được lưu trữ trong thùng rác trong vòng ');
DEFINE ('_UDDEIM_TRASHCAN_INFO_2', ' giờ trước khi bị xóa vĩnh viễn. Bạn chỉ có thể nhìn thấy từ đầu tiên trong nội dung tin nhắn. Để đọc được tin nhắn bạn phải khôi phục lại tin nhắn.');
DEFINE ('_UDDEIM_RECALLEDMESSAGE_INFO', 'Tin nhắn này vừa được thu hồi, bạn có thể sửa và gửi lại nó.');
DEFINE ('_UDDEIM_COULDNOTRECALL', 'Không thu hồi được tin nhắn (có thể nó đã được đọc hoặc bị xóa.)');
DEFINE ('_UDDEIM_CANTRESTORE', 'Khôi phục tin nhắn thất bại. (Có thể tin nhắn đã được chuyển tới thùng rác trong thời gian dài, và đã bị xóa.)');
DEFINE ('_UDDEIM_COULDNOTRESTORE', 'Khôi phục tin nhắn thất bại.');
DEFINE ('_UDDEIM_DONTSEND', 'Không gửi');
DEFINE ('_UDDEIM_SENDAGAIN', 'Gửi lại');
DEFINE ('_UDDEIM_NOTLOGGEDIN', 'Bạn chưa đăng nhập.');
DEFINE ('_UDDEIM_NOMESSAGES_INBOX', '<b>Bạn không có tin nhắn nào.</b>');
DEFINE ('_UDDEIM_NOMESSAGES_OUTBOX', '<b>Hộp thư đi không có thư nào.</b>');
DEFINE ('_UDDEIM_NOMESSAGES_TRASHCAN', '<b>Thùng rác không có thư nào.</b>');
DEFINE ('_UDDEIM_INBOX', 'Thư đến');
DEFINE ('_UDDEIM_OUTBOX', 'Thư đi');
DEFINE ('_UDDEIM_TRASHCAN', 'Thùng rác');
DEFINE ('_UDDEIM_CREATE', 'Tin nhắn mới');
DEFINE ('_UDDEIM_UDDEIM', 'Tin nhắn');
DEFINE ('_UDDEIM_READSTATUS', 'Đọc tin');
DEFINE ('_UDDEIM_FROM', 'Từ');
DEFINE ('_UDDEIM_FROM_SMALL', 'từ');
DEFINE ('_UDDEIM_TO', 'Tới');
DEFINE ('_UDDEIM_TO_SMALL', 'tới');
DEFINE ('_UDDEIM_OUTBOX_WARNING', 'Hộp thư đi chứa các tin nhắn bạn đã gửi. Bạn có thể thu lại các tin nhắn đã gửi nếu nó chưa được đọc, và người nhận sẽ không thể đọc được những tin nhắn đó nữa.');
// changed in 0.4
DEFINE ('_UDDEIM_RECALL', 'Thu hồi');
DEFINE ('_UDDEIM_RECALLTHISMESSAGE', 'Thu hồi tin nhắn');
DEFINE ('_UDDEIM_RESTORE', 'Khôi phục');
DEFINE ('_UDDEIM_MESSAGE', 'Tin nhắn');
DEFINE ('_UDDEIM_DATE', 'Ngày');
DEFINE ('_UDDEIM_DELETED', 'Ngày xóa');
DEFINE ('_UDDEIM_DELETE', 'Xóa');
DEFINE ('_UDDEIM_ONLINEPIC', 'images/icon_online.gif');
DEFINE ('_UDDEIM_OFFLINEPIC', 'images/icon_offline.gif');
DEFINE ('_UDDEIM_DELETELINK', 'Xóa');
DEFINE ('_UDDEIM_MESSAGENOACCESS', 'Tin nhắn không được hiển thị. <br />Lí do:<ul><li>Bạn không có quyên đọc tin nhắn này.</li><li>Tin nhắn đã bị xóa.</li></ul>');
DEFINE ('_UDDEIM_YOUMOVEDTOTRASH', '<b>Bạn đã xóa tin nhắn này.</b>');
DEFINE ('_UDDEIM_MESSAGEFROM', 'Tin nhắn từ ');
DEFINE ('_UDDEIM_MESSAGETO', 'Tin nhắn gửi từ bạn tới ');
DEFINE ('_UDDEIM_REPLY', 'Trả lời');
DEFINE ('_UDDEIM_SUBMIT', 'Gửi');
DEFINE ('_UDDEIM_DELETEREPLIED', 'Xóa tin nhắn đến sau khi trả lời');
DEFINE ('_UDDEIM_NOID', 'Lỗi: Không có người nhận. Tin nhắn chưa được gửi đi.');
DEFINE ('_UDDEIM_NOMESSAGE', 'Lỗi: Tin nhắn trống!');
DEFINE ('_UDDEIM_MESSAGE_REPLIEDTO', 'Đã gửi trả lời');
DEFINE ('_UDDEIM_MESSAGE_SENT', 'Đã gửi tin nhắn');
DEFINE ('_UDDEIM_MOVEDTOTRASH', ' và xóa tin nhắn đến');
DEFINE ('_UDDEIM_NOSUCHUSER', 'Không tìm thấy thành viên!');
DEFINE ('_UDDEIM_NOTTOYOURSELF', 'Bạn không thể tự gửi tin nhắn cho chính mình!');
DEFINE ('_UDDEIM_VIOLATION', '<b>Từ chối truy cập!</b> Bạn không có quyền thực hiện hành động này!');
DEFINE ('_UDDEIM_PRUNELINK', 'Dành cho admin: Lược bớt');
// Admin
DEFINE ('_UDDEADM_SETTINGS', 'uddeIM Administration');
DEFINE ('_UDDEADM_GENERAL', 'General');
DEFINE ('_UDDEADM_ABOUT', 'About');
DEFINE ('_UDDEADM_DATESETTINGS', 'Date/time');
DEFINE ('_UDDEADM_PICSETTINGS', 'Icons');
DEFINE ('_UDDEADM_DELETEREADAFTER_HEAD', 'Read messages kept for (days)');
DEFINE ('_UDDEADM_DELETEUNREADAFTER_HEAD', 'Unread messages kept for (days)');
DEFINE ('_UDDEADM_DELETETRASHAFTER_HEAD', 'Messages kept in trash for (days)');
DEFINE ('_UDDEADM_DAYS', 'day(s)');
DEFINE ('_UDDEADM_DELETEREADAFTER_EXP', 'Enter the number of days until <b>read</b> messages will be erased automatically from the inbox. If you do not want to erase messages automatically, enter a very high value (e.g. 36524 days are equivalent to one century). But keep in mind that the database can fill up quickly if you keep all messages.');
DEFINE ('_UDDEADM_DELETEUNREADAFTER_EXP', 'Enter the number of days until messages will be erased that have <b>not been read</b> by their intended recipient yet.');
DEFINE ('_UDDEADM_DELETETRASHAFTER_EXP', 'Enter the number of days until messages are erased from the trashcan. Decimal values are possible, e.g. to erase messages from the trashcan after 3 hours enter 0.125 as value.');
DEFINE ('_UDDEADM_DATEFORMAT_HEAD', 'Date display format');
DEFINE ('_UDDEADM_DATEFORMAT_EXP', 'Choose the format used when a date/time is being displayed. Months will be abbreviated according to your local language settings of Joomla (if a matching uddeIM language file is present).');
DEFINE ('_UDDEADM_LDATEFORMAT_HEAD', 'Longer date display');
DEFINE ('_UDDEADM_LDATEFORMAT_EXP', 'When displaying messages there is more space for the date/time string. Choose the date format to display when opening a message. For weekday names and months the local language settings of Joomla will be used (if a matching uddeIM language file is present).');
DEFINE ('_UDDEADM_ADMINIGNITIONONLY_HEAD', 'Deletions invoked');
DEFINE ('_UDDEADM_ADMINIGNITIONONLY_YES', 'by admins only');
DEFINE ('_UDDEADM_ADMINIGNITIONONLY_NO', 'by any user');
DEFINE ('_UDDEADM_ADMINIGNITIONONLY_MANUALLY', 'manually');
DEFINE ('_UDDEADM_ADMINIGNITIONONLY_EXP', 'Automatic deletions create heavy server load. If you choose <b>by admins only</b> automatic deletions are invoked when an admin checks his inbox. Choose this option if an admin is checking the inbox regulary. Small or rarely administered sites may choose <b>by any user</b>.');
// above string changed in 0.4
DEFINE ('_UDDEADM_SAVESETTINGS', 'Save settings');
DEFINE ('_UDDEADM_THISHASBEENSAVED', 'The following settings have been saved to config file:');
DEFINE ('_UDDEADM_SETTINGSSAVED', 'Settings have been saved.');
DEFINE ('_UDDEADM_ICONONLINEPIC_HEAD', 'Icon: User is online');
DEFINE ('_UDDEADM_ICONONLINEPIC_EXP', 'Enter the location of the icon to be displayed next to the username when this user is online.');
DEFINE ('_UDDEADM_ICONOFFLINEPIC_HEAD', 'Icon: User is offline');
DEFINE ('_UDDEADM_ICONOFFLINEPIC_EXP', 'Enter the location of the icon to be displayed next to the username when this user is offline.');
DEFINE ('_UDDEADM_ICONREADPIC_HEAD', 'Icon: Read message');
DEFINE ('_UDDEADM_ICONREADPIC_EXP', 'Enter the location of the icon to be displayed for read messages.');
DEFINE ('_UDDEADM_ICONUNREADPIC_HEAD', 'Icon: Unread message');
DEFINE ('_UDDEADM_ICONUNREADPIC_EXP', 'Enter the location of the icon to be displayed for unread messages.');
DEFINE ('_UDDEADM_MODULENEWMESS_HEAD', 'Module: New Messages Icon');
DEFINE ('_UDDEADM_MODULENEWMESS_EXP', 'This setting refers to the mod_uddeim module. Enter the location of the icon that this module shall display when there are new messages.');
// admin import tab
DEFINE ('_UDDEADM_UDDEINSTALL', 'uddeIM Installation');
DEFINE ('_UDDEADM_FINISHED', 'Installation is finished. Welcome to uddeIM. ');
DEFINE ('_UDDEADM_NOCB', '<span style="color: red;">You do not have Mambo Community Builder installed. You will not be able to use uddeIM.</span><br /><br />You might want to download <a href="http://www.mambojoe.com">Mambo Community Builder</a>.');
DEFINE ('_UDDEADM_CONTINUE', 'continue');
DEFINE ('_UDDEADM_PMSFOUND_1', 'There are ');
DEFINE ('_UDDEADM_PMSFOUND_2', ' messages in the old PMS installation. Do you want to import these messages into uddeIM?');
DEFINE ('_UDDEADM_IMPORT_EXP', 'This will not alter the old PMS messages or your installation. They will be kept intact and you can safely import them into uddeIM, even if you consider to continue using the old PMS. You should save any changes you made to the settings first before running the import! All messages that are already in your uddeIM database will remain intact.');
// _UDDEADM_IMPORT_EXP above changed in 0.4
DEFINE ('_UDDEADM_IMPORT_YES', 'Import old PMS messages into uddeIM now');
DEFINE ('_UDDEADM_IMPORT_NO', 'No, do not import any messages');
DEFINE ('_UDDEADM_IMPORTING', 'Please wait while messages are being imported.');
DEFINE ('_UDDEADM_IMPORTDONE', 'Done importing messages from old PMS. Do not run this installation script again because doing so will import the messages again and they will show up twice.');
DEFINE ('_UDDEADM_IMPORT', 'Import');
DEFINE ('_UDDEADM_IMPORT_HEADER', 'Import messages from old PMS');
DEFINE ('_UDDEADM_PMSNOTFOUND', 'No other PMS installation found. Import not possible.');
DEFINE ('_UDDEADM_ALREADYIMPORTED', '<span style="color: red;">You have already imported the messages from the old PMS into uddeIM.</span>');
// new in 0.3 Frontend
DEFINE ('_UDDEIM_BLOCKS', 'Đã khóa');
DEFINE ('_UDDEIM_YOUAREBLOCKED', 'Không gửi được (người nhận đã khóa nick của bạn)');
DEFINE ('_UDDEIM_BLOCKNOW', 'Chặn');
DEFINE ('_UDDEIM_BLOCKS_EXP', 'Dưới đây là danh sách các thành viên bạn đã chặn. Họ sẽ không thể tiếp tục gửi tin nhắn tới cho bạn.');
DEFINE ('_UDDEIM_NOBODYBLOCKED', 'Hiện tại bạn không chặn tin nhắn từ bất kì thành viên nào');
DEFINE ('_UDDEIM_YOUBLOCKED_PRE', 'Bạn đang chặn ');
DEFINE ('_UDDEIM_YOUBLOCKED_POST', ' thành viên.');
DEFINE ('_UDDEIM_UNBLOCKNOW', '[Mở khóa]');
DEFINE ('_UDDEIM_BLOCKALERT_EXP_ON', 'Khi các thành viên bị chặn gửi tin nhắn cho bạn, họ sẽ nhận được thông tin họ đã bị chặn và tin nhắn không được gửi.');
DEFINE ('_UDDEIM_BLOCKALERT_EXP_OFF', 'Người bị chặn sẽ không biết rằng bạn đã chặn họ.');
DEFINE ('_UDDEIM_CANTBLOCKADMINS', 'Bạn không thể chặn admin.');
// new in 0.3 Admin
DEFINE ('_UDDEADM_BLOCKSYSTEM_HEAD', 'Enable blocking system');
DEFINE ('_UDDEADM_BLOCKSYSTEM_EXP', 'When enabled, users can block other users. A blocked user can not send messages to the user who has blocked him. Admins can\'t be blocked.');
DEFINE ('_UDDEADM_BLOCKSYSTEM_YES', 'yes');
DEFINE ('_UDDEADM_BLOCKSYSTEM_NO', 'no');
DEFINE ('_UDDEADM_BLOCKALERT_HEAD', 'Blocked user information');
DEFINE ('_UDDEADM_BLOCKALERT_EXP', 'If set to <b>yes</b>, a blocked user will be informed that the message has not been sent because the recipient has blocked him. If set to <b>no</b>, the blocked user does not get any notification that the message has not been sent.');
DEFINE ('_UDDEADM_BLOCKALERT_YES', 'yes');
DEFINE ('_UDDEADM_BLOCKALERT_NO', 'no');
DEFINE ('_UDDEIM_BLOCKSDISABLED', 'Hệ thống chặn tin nhắn đã tắt');
// DEFINE ('_UDDEADM_DELETIONS', 'Messages');
// translators info: comment out or delete line above to avoid double definition.
// new definition right below.
DEFINE ('_UDDEADM_DELETIONS', 'Deletion'); // changed in 0.4
DEFINE ('_UDDEADM_BLOCK', 'Blocking');
// new in 0.4, admin
DEFINE ('_UDDEADM_INTEGRATION', 'Integration');
DEFINE ('_UDDEADM_EMAIL', 'E-mail');
DEFINE ('_UDDEADM_SHOWONLINE_HEAD', 'Show online status');
DEFINE ('_UDDEADM_SHOWONLINE_EXP', 'When set to <b>yes</b>, uddeIM displays every username with a small icon that informs if this user is online or offline.');
DEFINE ('_UDDEADM_ALLOWEMAILNOTIFY_HEAD', 'Allow e-mail notification');
DEFINE ('_UDDEADM_ALLOWEMAILNOTIFY_EXP', 'When set to <b>yes</b>, users can choose if they want to get an e-mail every time a new message arrives in the inbox.');
DEFINE ('_UDDEADM_EMAILWITHMESSAGE_HEAD', 'E-mail contains message');
DEFINE ('_UDDEADM_EMAILWITHMESSAGE_EXP', 'When set to <b>no</b>, this e-mail will only contain information about when and by whom the message was sent, but not the message itself.');
DEFINE ('_UDDEADM_LONGWAITINGEMAIL_HEAD', 'Forgetmenot e-mail');
DEFINE ('_UDDEADM_LONGWAITINGEMAIL_EXP', 'This feature sends an e-mail to users who have unread messages in their inbox for a very long time (set below). This setting is independent from the \'allow e-mail notification\'. If you do not want to send out any e-mail messages you have to turn off both.');
DEFINE ('_UDDEADM_LONGWAITINGDAYS_HEAD', 'Forgetmenot sent after day(s)');
DEFINE ('_UDDEADM_LONGWAITINGDAYS_EXP', 'If the forgetmenot feature (above) is set to <b>yes</b>, set here after how many days e-mail notifications about unread messages shall be dispatched.');
DEFINE ('_UDDEADM_FIRSTWORDSINBOX_HEAD', 'First characters list');
DEFINE ('_UDDEADM_FIRSTWORDSINBOX_EXP', 'You can set here how many characters of a message will be displayed in the inbox, outbox and trashcan.');
DEFINE ('_UDDEADM_MAXLENGTH_HEAD', 'Message maximum length');
DEFINE ('_UDDEADM_MAXLENGTH_EXP', 'Set the maximum length of a message (a message will be truncated automatically when its length exceeds this value). Set to \'0\' to allow for messages of any length (not recommended).');
DEFINE ('_UDDEADM_YES', 'yes');
DEFINE ('_UDDEADM_NO', 'no');
DEFINE ('_UDDEADM_ADMINSONLY', 'admins only');
DEFINE ('_UDDEADM_SYSTEM', 'System');
DEFINE ('_UDDEADM_SYSM_USERNAME_HEAD', 'System messages username');
DEFINE ('_UDDEADM_SYSM_USERNAME_EXP', 'uddeIM supports system messages. They do not have a sender and users can\'t reply to them. Enter here the default username alias for system messages (for example <b>Support</b> or <b>Help desk</b> or <b>Community Master</b>).');
DEFINE ('_UDDEADM_ALLOWTOALL_HEAD', 'Allow admins to send general messages');
DEFINE ('_UDDEADM_ALLOWTOALL_EXP', 'uddeIM supports general messages. They are sent to every user on your system. Use them sparingly.');
DEFINE ('_UDDEADM_EMN_SENDERNAME_HEAD', 'E-mail sender name');
DEFINE ('_UDDEADM_EMN_SENDERNAME_EXP', 'Enter the name from which e-mail notifications come from (for example <b>Your Site</b> or <b>Messaging Service</b>)');
DEFINE ('_UDDEADM_EMN_SENDERMAIL_HEAD', 'E-mail sender address');
DEFINE ('_UDDEADM_EMN_SENDERMAIL_EXP', 'Enter the e-mail address from which e-mail notifications are sent from (this should be the main contact e-mail address of your site.');
DEFINE ('_UDDEADM_VERSION', 'uddeIM version');
DEFINE ('_UDDEADM_ARCHIVE', 'Archive'); // translators info: headline for Archive system
DEFINE ('_UDDEADM_ALLOWARCHIVE_HEAD', 'Enable archive');
DEFINE ('_UDDEADM_ALLOWARCHIVE_EXP', 'Choose if users shall be allowed to store messages in an archive. Messages in the archive will not be deleted automatically.');
DEFINE ('_UDDEADM_MAXARCHIVE_HEAD', 'Max messages in archive');
DEFINE ('_UDDEADM_MAXARCHIVE_EXP', 'Set how many messages every user may store in the archive (no limit for admins).');
DEFINE ('_UDDEADM_COPYTOME_HEAD', 'Allow self copies');
DEFINE ('_UDDEADM_COPYTOME_EXP', 'Allows users to receive copies of messages they are sending. These copies will appear in the inbox.');
DEFINE ('_UDDEADM_MESSAGES', 'Messages');
DEFINE ('_UDDEADM_TRASHORIGINAL_HEAD', 'Suggest to trash original');
DEFINE ('_UDDEADM_TRASHORIGINAL_EXP', 'When activated this will put a checkbox next to the \'Send\' reply button called \'trash original\' that is checked by default. In this case a message will immediately be moved from the inbox to trashcan when a reply has been sent. This function reduces the number of messages kept in the database. Users can uncheck the box if they want to keep a message in the inbox.');
// translators info: 'Send' is the same as _UDDEIM_SUBMIT,
// and 'trash original' the same as _UDDEIM_TRASHORIGINAL
DEFINE ('_UDDEADM_PERPAGE_HEAD', 'Messages per page');
DEFINE ('_UDDEADM_PERPAGE_EXP', 'Define here the number of messages displayed per page in inbox, outbox, trashcan and archive.');
DEFINE ('_UDDEADM_CHARSET_HEAD', 'Used charset');
DEFINE ('_UDDEADM_CHARSET_EXP', 'If you\'re experiencing problems with non-latin character sets displayed, you can enter the charset uddeIM uses to convert database output to HTML code here. The default value is correct for most European languages.');
DEFINE ('_UDDEADM_MAILCHARSET_HEAD', 'Used mail charset');
DEFINE ('_UDDEADM_MAILCHARSET_EXP', 'If you\'re experiencing problems with non-latin character sets displayed, you can enter the charset uddeIM uses to send outgoing e-mails with. The default value is correct for most European languages.');
// translators info: if you're translating into a language that uses a latin charset
// (like English, Dutch, German, Swedish, Spanish, ... ) you might want to add a line
// saying 'For usage in [mylanguage] the default value is correct.'
DEFINE ('_UDDEADM_EMN_BODY_NOMESSAGE_EXP', 'This is the content of the e-mail users will receive when the option is set above. The content of the message will not be in the e-mail. Keep the variables %you%, %user% and %site% intact. ');
DEFINE ('_UDDEADM_EMN_BODY_WITHMESSAGE_EXP', 'This is the content of the e-mail users will receive when the option is set above. This e-mail will include the content of the message. Keep the variables %you%, %user%, %pmessage% and %site% intact. ');
DEFINE ('_UDDEADM_EMN_FORGETMENOT_EXP', 'This is the content of the forgetmenot e-mail users will receive when the option is set above. Keep the variables %you% and %site% intact. ');
DEFINE ('_UDDEADM_ENABLEDOWNLOAD_EXP', 'Allow users to download messages from their archive by sending them as e-mail to themselves.');
DEFINE ('_UDDEADM_ENABLEDOWNLOAD_HEAD', 'Allow download');
DEFINE ('_UDDEADM_EXPORT_FORMAT_EXP', 'This is the format of the e-mail users will receive when they download their own messages from the archive. Keep the variables %user%, %msgdate% and %msgbody% intact. ');
// translators info: Don't translate %you%, %user%, etc. in the strings above.
DEFINE ('_UDDEADM_INBOXLIMIT_HEAD', 'Set inbox limit');
DEFINE ('_UDDEADM_INBOXLIMIT_EXP', 'You can include the number of messages in the inbox into the maximum number of archived messages. In this case, the number of messages in inbox and archive in total must not exceed the number set above. Alternatively, you can set the inbox limit without an archive. In this case, users may have no more than the number of messages set above in their inboxes. If the number is reached, they will no longer be able to reply to messages or to compose new ones until they delete old messages from the inbox or archive respectively (users will still be able to receive and read messages).');
DEFINE ('_UDDEADM_SHOWINBOXLIMIT_HEAD', 'Show limit usage at inbox');
DEFINE ('_UDDEADM_SHOWINBOXLIMIT_EXP', 'Display how many messages users have stored (and how many they are allowed to store) in a line below the inbox.');
DEFINE ('_UDDEADM_ARCHIVETOTRASH_INTRO', 'You have turned off the archive. How do you want to handle messages that are saved in the archive?');
DEFINE ('_UDDEADM_ARCHIVETOTRASH_LEAVE_LINK', 'Leave them');
DEFINE ('_UDDEADM_ARCHIVETOTRASH_LEAVE_EXP', 'Leave them in the archive (user will not be able to access the messages and they will still count against message limits).');
DEFINE ('_UDDEADM_ARCHIVETOTRASH_INBOX_LINK', 'Move to inbox');
DEFINE ('_UDDEADM_ARCHIVETOTRASH_INBOX_DONE', 'Archived messages moved to inboxes');
DEFINE ('_UDDEADM_ARCHIVETOTRASH_INBOX_EXP', 'Messages will be moved to the inbox of the respective user (or to trash if they are older than allowed in the inbox).');
// 0.4 frontend, admins only (no translation necessary)
DEFINE ('_UDDEIM_VALIDFOR_1', 'Có giá trị trong ');
DEFINE ('_UDDEIM_VALIDFOR_2', ' giờ. 0=vĩnh viễn (Tự động xóa sau thời gian định trước)');
DEFINE ('_UDDEIM_WRITE_SYSM_GM', '[Tạo tin nhắn hệ thống hoặc tin nhắn chung]');
DEFINE ('_UDDEIM_WRITE_NORMAL', '[Tạo tin nhắn thông thường]');
DEFINE ('_UDDEIM_NOTALLOWED_SYSM_GM', 'Không cho phép tạo tin nhắn hệ thống và tin nhắn chung.');
DEFINE ('_UDDEIM_SYSGM_TYPE', 'Kiểu tin nhắn');
DEFINE ('_UDDEIM_HELPON_SYSGM', 'Trợ giuso trong hệ thống tin nhắn');
DEFINE ('_UDDEIM_HELPON_SYSGM_2', '(Mở với cửa sổ mới)');
DEFINE ('_UDDEIM_SYSGM_PLEASECONFIRM', 'Bạn chuẩn bị gửi tin nhắn với nội dung dưới đây, vui lòng xác nhận lại!');
DEFINE ('_UDDEIM_SYSGM_WILLSENDTOALL', 'Gửi tin nhắn tới <b>tất cả các thành viên</b>');
DEFINE ('_UDDEIM_SYSGM_WILLSENDTOALLADMINS', 'Gửi tin nhắn tới <b>nhóm admin</b>');
DEFINE ('_UDDEIM_SYSGM_WILLSENDTOALLLOGGED', 'Gửi tin nhắn tới <b>các thành viên đang online</b>');
DEFINE ('_UDDEIM_SYSGM_WILLDISABLEREPLY', 'Người nhận không thể trả lời tin nhắn này.');
DEFINE ('_UDDEIM_SYSGM_WILLSENDAS_1', 'Tin nhắn sẽ được gửi đi dưới tên người gửi là <b>');
DEFINE ('_UDDEIM_SYSGM_WILLSENDAS_2', '</b>');
DEFINE ('_UDDEIM_SYSGM_WILLEXPIRE', 'Tin nhắn sẽ hết hạn và bị xóa vào lúc ');
DEFINE ('_UDDEIM_SYSGM_WILLNOTEXPIRE', 'Tin nhắn vô thời hạn');
DEFINE ('_UDDEIM_SYSGM_CHECKLINK', '<b>Kiển tra liên kết (bằng cách nhấn vào liên kết) trước khi tiến hành!</b>');
DEFINE ('_UDDEIM_SYSGM_SHORTHELP', 'Chỉ sử dụng <b>tin nhắn hệ thống</b>:<br /> [b]<b>In đậm</b>[/b] [i]<em>In nghiêng</em>[/i]<br />
[url=http://www.someurl.com]some url[/url] hoặc [url]http://www.someurl.com[/url] là các liên kết');
DEFINE ('_UDDEIM_SYSGM_ERRORNORECIPS', 'Lỗi: Không có người nhận này. Tin nhắn chưa được gửi đi.');
DEFINE ('_UDDEIM_CANTREPLY', 'Đây là tin nhắn hệ thống. Bạn không thể trả lời tin nhắn này.');
DEFINE ('_UDDEIM_EMNOFF', 'Email thông báo đã tắt. ');
DEFINE ('_UDDEIM_EMNON', 'Email thông báo đã bật. ');
DEFINE ('_UDDEIM_SETEMNON', '[bật]');
DEFINE ('_UDDEIM_SETEMNOFF', '[tắt]');
DEFINE ('_UDDEIM_EMN_BODY_NOMESSAGE',
"Chào %you%,\n\n%user% đã gửi tin nhắn cho bạn tại %site%. Hãy đăng nhập để đọc tin nhắn!");
DEFINE ('_UDDEIM_EMN_BODY_WITHMESSAGE',
"Chào %you%,\n\n%user% đã gửi tin nhắn sau cho bạn tại %site%. Hãy đăng nhập để trả lời tin nhắn!\n__________________\n%pmessage%");
DEFINE ('_UDDEIM_EMN_FORGETMENOT',
"Chào %you%,\n\nBạn có tin nhắn chưa đọc tại %site%. Hãy đăng nhập để đọc tin nhắn!");
DEFINE ('_UDDEIM_EXPORT_FORMAT', '
================================================================================
%user% (%msgdate%)
----------------------------------------
%msgbody%
================================================================================');
DEFINE ('_UDDEIM_EMN_SUBJECT', 'Ban co tin nhan tai %site%');
DEFINE ('_UDDEIM_SEND_ASSYSM', 'Gửi tin nhắn hệ thống (=Người nhận không thể trả lời)');
DEFINE ('_UDDEIM_SEND_TOALL', 'Gửi tới tất cả các thành viên');
DEFINE ('_UDDEIM_SEND_TOALLADMINS', 'Gửi tới nhóm admin');
DEFINE ('_UDDEIM_SEND_TOALLLOGGED', 'Gửi tới tất cả các thành viên online');
DEFINE ('_UDDEIM_UNEXPECTEDERROR_QUIT', 'Lỗi xảy ra: ');
DEFINE ('_UDDEIM_ARCHIVENOTENABLED', 'Không cho phép lưu trữ.');
DEFINE ('_UDDEIM_ARCHIVE_ERROR', 'Lỗi lưu trữ tin nhắn.');
DEFINE ('_UDDEIM_ARC_SAVED_1', 'Bạn đã lưu trữ ');
DEFINE ('_UDDEIM_ARC_SAVED_NONE', '<b>Bạn chưa lưu trữ tin nhắn nào.</b>');
DEFINE ('_UDDEIM_ARC_SAVED_NONE_2', '<b>Lưu trữ không có thư nào.</b>');
DEFINE ('_UDDEIM_ARC_SAVED_2', ' tin nhắn');
DEFINE ('_UDDEIM_ARC_SAVED_ONE', 'Bạn đã lưu trữ 1 tin nhắn');
DEFINE ('_UDDEIM_ARC_SAVED_3', 'Để lưu trữ thêm tin nhắn, bạn phải xóa bớt vào tin nhắn đã lưu trữ.');
DEFINE ('_UDDEIM_ARC_CANSAVEMAX_1', 'Bạn có thể lưu trữ tối đa ');
DEFINE ('_UDDEIM_ARC_CANSAVEMAX_2', ' tin nhắn.');
DEFINE ('_UDDEIM_INBOX_LIMIT_1', 'Bạn có ');
DEFINE ('_UDDEIM_INBOX_LIMIT_2', ' tin nhắn trong');
DEFINE ('_UDDEIM_INBOX_LIMIT_2_SINGULAR', ' tin nhắn trong'); // same as _UDDEIM_INBOX_LIMIT_2, but singular (as in one "message in your")
DEFINE ('_UDDEIM_ARC_UNIVERSE_ARC', 'lưu trữ');
DEFINE ('_UDDEIM_ARC_UNIVERSE_INBOX', 'hộp thư đến');
DEFINE ('_UDDEIM_ARC_UNIVERSE_BOTH', 'hộp thư đến và lưu trữ');
DEFINE ('_UDDEIM_INBOX_LIMIT_3', 'Cho phép tối đa ');
DEFINE ('_UDDEIM_INBOX_LIMIT_4', 'Bạn vẫn có thể nhận và đọc tin nhắn nhưng không thể gửi tin nhắn hoặc soạn tin nhắn mới cho đến khi bạn xóa bớt một vài tin nhắn.');
DEFINE ('_UDDEIM_SHOWINBOXLIMIT_1', 'Tin nhắn đã lưu trữ: ');
DEFINE ('_UDDEIM_SHOWINBOXLIMIT_2', '(Tối đa ');
DEFINE ('_UDDEIM_MESSAGE_ARCHIVED', 'Lưu tin nhắn vào hộp lưu trữ.');
DEFINE ('_UDDEIM_STORE', 'Lưu trữ'); // translators info: as in: 'store this message in archive now'
DEFINE ('_UDDEIM_BACK', 'Quay lại');
DEFINE ('_UDDEIM_TRASHCHECKED', 'Xóa các tin đã chọn'); // translators info: plural!
DEFINE ('_UDDEIM_SHOWALL', 'Xem tất cả'); // translators example "SHOW ALL messages"
DEFINE ('_UDDEIM_ARCHIVE', 'Lưu trữ'); // should be same as _UDDEADM_ARCHIVE
DEFINE ('_UDDEIM_ARCHIVEFULL', 'Hộp lưu trữ đã đầy.');
DEFINE ('_UDDEIM_NOMSGSELECTED', 'Không có tin nhắn nào được chọn.');
DEFINE ('_UDDEIM_THISISACOPY', 'Sao lưu một tin nhắn đã gửi tới ');
DEFINE ('_UDDEIM_SENDCOPYTOME', 'Gửi một bản sao cho tôi');
DEFINE ('_UDDEIM_SENDCOPYTOARCHIVE', 'Sao lưu vào lưu trữ');
DEFINE ('_UDDEIM_TRASHORIGINAL', 'Xóa bản gốc');
DEFINE ('_UDDEIM_MESSAGEDOWNLOAD', 'Download tin nhắn');
DEFINE ('_UDDEIM_EXPORT_MAILED', 'Đã gửi email kèm với các tin nhắn');
DEFINE ('_UDDEIM_EXPORT_NOW', 'Gửi email cho tôi các tin nhắn đã chọn');
DEFINE ('_UDDEIM_EXPORT_MAIL_INTRO', 'Email này bao gồm các tin nhắn của bạn.');
DEFINE ('_UDDEIM_EXPORT_COULDNOTSEND', 'Không thể gửi email kèm các tin nhắn.');
DEFINE ('_UDDEIM_LIMITREACHED', 'Tin nhắn đã đầy! Không thể lưu trữ tiếp.');
DEFINE ('_UDDEIM_WRITEMSGTO', 'Gửi tin nhắn tới ');
$udde_smon[1]="Tháng 1";
$udde_smon[2]="Tháng 2";
$udde_smon[3]="Tháng 3";
$udde_smon[4]="Tháng 4";
$udde_smon[5]="Tháng 5";
$udde_smon[6]="Tháng 6";
$udde_smon[7]="Tháng 7";
$udde_smon[8]="Tháng 8";
$udde_smon[9]="Tháng 9";
$udde_smon[10]="Tháng 10";
$udde_smon[11]="Tháng 11";
$udde_smon[12]="Tháng 12";
$udde_lmon[1]="Tháng 1";
$udde_lmon[2]="Tháng 2";
$udde_lmon[3]="Tháng 3";
$udde_lmon[4]="Tháng 4";
$udde_lmon[5]="Tháng 5";
$udde_lmon[6]="Tháng 6";
$udde_lmon[7]="Tháng 7";
$udde_lmon[8]="Tháng 8";
$udde_lmon[9]="Tháng 9";
$udde_lmon[10]="Tháng 10";
$udde_lmon[11]="Tháng 11";
$udde_lmon[12]="Tháng 12";
$udde_lweekday[0]="CN";
$udde_lweekday[1]="Thứ 2";
$udde_lweekday[2]="Thứ 3";
$udde_lweekday[3]="Thứ 4";
$udde_lweekday[4]="Thứ 5";
$udde_lweekday[5]="Thứ 6";
$udde_lweekday[6]="Thứ 7";
$udde_sweekday[0]="Chủ nhật";
$udde_sweekday[1]="Thứ 2";
$udde_sweekday[2]="Thứ 3";
$udde_sweekday[3]="Thứ 4";
$udde_sweekday[4]="Thứ 5";
$udde_sweekday[5]="Thứ 6";
$udde_sweekday[6]="Thứ 7";
// new in 0.5 ADMIN
DEFINE ('_UDDEADM_TEMPLATEDIR_HEAD', 'uddeIM Template');
DEFINE ('_UDDEADM_TEMPLATEDIR_EXP', 'Choose the template you want uddeIM to use');
DEFINE ('_UDDEADM_SHOWCONNEX_HEAD', 'Show connections');
DEFINE ('_UDDEADM_SHOWCONNEX_EXP', 'Use <b>yes</b> if you have CB/CBE/JS installed and want to display the user\'s connections on the compose new message page.');
DEFINE ('_UDDEADM_SHOWSETTINGSLINK_HEAD', 'Show settings');
DEFINE ('_UDDEADM_SHOWSETTINGSLINK_EXP', 'The settings link appears automatically in uddeIM if you have e-mail notification or the blocking system activated. You can specify its position and you can turn it off completely.');
DEFINE ('_UDDEADM_SHOWSETTINGS_ATBOTTOM', 'yes, at bottom');
DEFINE ('_UDDEADM_ALLOWBB_HEAD', 'Allow BB code tags');
DEFINE ('_UDDEADM_FONTFORMATONLY', 'font formats only');
DEFINE ('_UDDEADM_ALLOWBB_EXP', 'Use <b>font formats only</b> to allow users to use the BB code tags for bold, italic, underline, font color and font size. When you set this option to <b>yes</b>, users are allowed to use <b>all</b> supported BB code tags (e.g. links and images).');
DEFINE ('_UDDEADM_ALLOWSMILE_HEAD', 'Allow Emoticons');
DEFINE ('_UDDEADM_ALLOWSMILE_EXP', 'When set to <b>yes</b>, emoticon codes like :-) are replaced with emoticon graphics in message display.');
DEFINE ('_UDDEADM_DISPLAY', 'Display');
DEFINE ('_UDDEADM_SHOWMENUICONS_HEAD', 'Show Menu Icons');
DEFINE ('_UDDEADM_SHOWMENUICONS_EXP', 'When set to <b>yes</b>, menu links will be displayed using an icon.');
DEFINE ('_UDDEADM_SHOWTITLE_HEAD', 'Component Title');
DEFINE ('_UDDEADM_SHOWTITLE_EXP', 'Enter the headline of the private messaging component, for example \'Private Messages\'. Leave empty if you do not want to display a headline.');
DEFINE ('_UDDEADM_SHOWABOUT_HEAD', 'Show About link');
DEFINE ('_UDDEADM_SHOWABOUT_EXP', 'Set to <b>yes</b> to show a link to the uddeIM software credits and license. This link will be placed at the bottom of the uddeIM output.');
DEFINE ('_UDDEADM_STOPALLEMAIL_HEAD', 'Stop e-mail');
DEFINE ('_UDDEADM_STOPALLEMAIL_EXP', 'Check this box to prevent uddeIM from sending out e-mails (e-mail notifications and forgetmenot e-mails) irrespective of the users\' settings, for example when testing the site.');
DEFINE ('_UDDEADM_GETPICLINK_HEAD', 'CB thumbnails in lists');
DEFINE ('_UDDEADM_GETPICLINK_EXP', 'Set to <b>yes</b> if you want to display Community Builder thumbnails in the message lists overview (inbox, outbox, etc.)');
// new in 0.5 FRONTEND
DEFINE ('_UDDEIM_SHOWUSERS', 'Xem thành viên');
DEFINE ('_UDDEIM_CONNECTIONS', 'Bạn bè');
DEFINE ('_UDDEIM_SETTINGS', 'Cấu hình');
DEFINE ('_UDDEIM_NOSETTINGS', 'Không có thiết lập nào được áp dụng.');
DEFINE ('_UDDEIM_ABOUT', 'About'); // as in "About uddeIM"
DEFINE ('_UDDEIM_COMPOSE', 'Soạn tin'); // as in "write new message", but only one word
DEFINE ('_UDDEIM_EMN', 'Thông báo qua Email');
DEFINE ('_UDDEIM_EMN_EXP', 'Cấu hình thông báo tin nhắn mới.');
DEFINE ('_UDDEIM_EMN_ALWAYS', 'Thông báo qua email nếu có tin nhắn mới');
DEFINE ('_UDDEIM_EMN_NONE', 'Không thông báo qua email');
DEFINE ('_UDDEIM_EMN_WHENOFFLINE', 'Thông báo qua email khi không online');
DEFINE ('_UDDEIM_EMN_NOTONREPLY', 'Không gửi thông báo với các thư trả lời');
DEFINE ('_UDDEIM_BLOCKSYSTEM', 'Chặn thành viên'); // Headline for blocking system in settings
DEFINE ('_UDDEIM_BLOCKSYSTEM_EXP', 'Bạn có thể chặn các thành viên để ngăn họ gửi tin nhắn tới bạn. Chọn <b>chặn</b> khi bạn xem tin nhắn từ họ.'); // block user is the same as _UDDEIM_BLOCKNOW
DEFINE ('_UDDEIM_SAVECHANGE', 'Lưu thay đổi');
DEFINE ('_UDDEIM_TOOLTIP_BOLD', 'BB code tags to produce bold text. Usage: [b]bold[/b]');
DEFINE ('_UDDEIM_TOOLTIP_ITALIC', 'BB code tags to produce italic text. Usage: [i]italic[/i]');
DEFINE ('_UDDEIM_TOOLTIP_UNDERLINE', 'BB code tags to produce underlined text. Usage: [u]underline[/u]');
DEFINE ('_UDDEIM_TOOLTIP_COLORRED', 'BB code tags to produce coloured letters. Usage [color=#XXXXXX]colored[/color] where XXXXXX is the hex code of the colour you want, for example FF0000 for red.');
DEFINE ('_UDDEIM_TOOLTIP_COLORGREEN', 'BB code tags to produce coloured letters. Usage [color=#XXXXXX]colored[/color] where XXXXXX is the hex code of the colour you want, for example 00FF00 for green.');
DEFINE ('_UDDEIM_TOOLTIP_COLORBLUE', 'BB code tags to produce coloured letters. Usage [color=#XXXXXX]colored[/color] where XXXXXX is the hex code of the colour you want, for example 0000FF for blue.');
DEFINE ('_UDDEIM_TOOLTIP_FONTSIZE1', 'BB code tags to produce very small letters. Usage: [size=1]very small text.[/size]');
DEFINE ('_UDDEIM_TOOLTIP_FONTSIZE2', 'BB code tags to produce small letters. Usage: [size=2] small text.[/size]');
DEFINE ('_UDDEIM_TOOLTIP_FONTSIZE4', 'BB code tags to produce big letters. Usage: [size=4]big text.[/size]');
DEFINE ('_UDDEIM_TOOLTIP_FONTSIZE5', 'BB code tags to produce very big letters. Usage: [size=5]very big text.[/size]');
DEFINE ('_UDDEIM_TOOLTIP_IMAGE', 'BB code tags to insert a link to an image. Usage: [img]Image-URL[/img]');
DEFINE ('_UDDEIM_TOOLTIP_URL', 'BB code tags to insert a hyperlink. Usage: [url]web address[/url]. Do not forget the http:// at the beginning of the web address.');
DEFINE ('_UDDEIM_TOOLTIP_CLOSEALLTAGS', 'Close all open BB code tags.');
| gpl-2.0 |
Wittyshare/wscore | tests/User/main.cpp | 327 | /**
*
* @file main.cpp
*
* @brief Main class for tests
*
* @version 1.0
* @date 07/11/11 10:46:15
*
* Author: Benoit Daccache, ben.daccache@gmail.com
*
*
*/
#include "UserTest.h"
int main()
{
UserTest test;
test.runTests();
cout << "All user tests succeded" << endl;
return 0;
}
| gpl-2.0 |
pachuc/dijjer | src/dijjer/io/xfer/http/HttpBlockReceiver.java | 3218 | /*
* Dijjer - A Peer to Peer HTTP Cache
* Copyright (C) 2004,2005 Change.Tv, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package dijjer.io.xfer.http;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import dijjer.io.BlockInfo;
import dijjer.io.comm.RetrievalException;
import dijjer.io.store.Store;
import dijjer.io.xfer.InputStreamBlockReceiver;
import dijjer.io.xfer.PartiallyReceivedBlock;
import dijjer.util.Misc;
import dijjer.util.logging.Logger;
/**
* @author ian
*
* To change the template for this generated type comment go to Window - Preferences - Java - Code Generation - Code and
* Comments
*/
public class HttpBlockReceiver {
protected URL _url;
protected int _blockNumber;
protected PartiallyReceivedBlock _prb;
protected long _totalLength;
public HttpBlockReceiver(BlockInfo bi, PartiallyReceivedBlock prb) {
this(bi.getUrl(), bi.getFileLength(), bi.getBlockNo(), prb);
}
public HttpBlockReceiver(URL url, long totalLength, int blockNumber, PartiallyReceivedBlock prb) {
_url = url;
_blockNumber = blockNumber;
_prb = prb;
_totalLength = totalLength;
}
public void start() throws IOException, RetrievalException {
Logger.debug("Beginning http retrieval of "+_url+" block "+_blockNumber);
URL actualURL = _url;
HttpURLConnection uc;
while (!_prb.isAborted()) {
uc = Misc.openHttpUrlConnection(actualURL);
long rangeStart = (Store.DATA_BLOCK_SIZE * _blockNumber);
long rangeEnd = (Math.min(_totalLength, Store.DATA_BLOCK_SIZE * (_blockNumber + 1)) - 1);
uc.setRequestProperty("Range", "bytes=" + rangeStart + "-" + rangeEnd);
// Prevent hangs, suggested in:
// http://forum.java.sun.com/thread.jspa?threadID=17410&messageID=42113
System.setProperty("sun.net.client.defaultConnectTimeout", "20000");
System.setProperty("sun.net.client.defaultReadTimeout", "20000");
uc.connect();
if (uc.getHeaderField("Location") != null) {
actualURL = new URL(uc.getHeaderField("Location"));
uc.disconnect();
continue;
}
if (uc.getResponseCode() != HttpURLConnection.HTTP_PARTIAL) {
//416 loop error occurs (occurred?) here
uc.disconnect();
_prb.abort(RetrievalException.UNKNOWN, "Server responded with response code: " + uc.getResponseCode());
continue;
}
//Stuff below here is only executed once
InputStream is = uc.getInputStream();
InputStreamBlockReceiver isrb = new InputStreamBlockReceiver(_prb, is);
isrb.start();
break;
}
}
}
| gpl-2.0 |
ScottJr/mgallagher | wp-content/themes/mgallagher2015/content-search.php | 814 | <?php
/**
* The template part for displaying results in search pages.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package mgallagher2015
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
<?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta">
<?php mgallagher2015_posted_on(); ?>
</div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header -->
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<footer class="entry-footer">
<?php mgallagher2015_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
| gpl-2.0 |
s2sprodotti/SDS | SistemaDellaSicurezza/src/com/apconsulting/luna/ejb/ContServLuoghiEsecuzione/IContServLuoghiEsecuzione.java | 1977 | /** ======================================================================== */
/** */
/** @copyright Copyright (c) 2010-2015, S2S s.r.l. */
/** @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License v.2 */
/** @version 6.0 */
/** This file is part of SdS - Sistema della Sicurezza . */
/** SdS - Sistema della Sicurezza is free software: you can redistribute it and/or modify */
/** it under the terms of the GNU General Public License as published by */
/** the Free Software Foundation, either version 3 of the License, or */
/** (at your option) any later version. */
/** SdS - Sistema della Sicurezza is distributed in the hope that it will be useful, */
/** but WITHOUT ANY WARRANTY; without even the implied warranty of */
/** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/** GNU General Public License for more details. */
/** You should have received a copy of the GNU General Public License */
/** along with SdS - Sistema della Sicurezza . If not, see <http://www.gnu.org/licenses/gpl-2.0.html> GNU Public License v.2 */
/** */
/** ======================================================================== */
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.apconsulting.luna.ejb.ContServLuoghiEsecuzione;
import javax.ejb.EJBObject;
/**
*
* @author Dario
*/
// Interfaccia remota.
public interface IContServLuoghiEsecuzione extends EJBObject {
// Campi obbligatori
// COD_SRV
public long getCOD_SRV();
public void setCOD_SRV(long newCOD_SRV);
// COD_LUO_FSC
public long getCOD_LUO_FSC();
public void setCOD_LUO_FSC(long newCOD_LUO_FSC);
// Campi opzionali
// DES_SER
public String getDES_SER();
public void setDES_SER(String newDES_SER);
}
| gpl-2.0 |
kaseyan/memo | WebContent/js/wsmemo.js | 351 |
function $(id) {
return document.getElementById(id);
}
function createXMLHttpRequest() {
var res = null;
try {
res = new XMLHttpRequest();
} catch (e) {
try {
res = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
res = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return null;
}
}
}
return res;
}
| gpl-2.0 |
rymesaint/dimensi | application/modules/anime/controllers/Anime.php | 11661 | <?php defined('BASEPATH') OR exit('No direct script access allowed');
class Anime extends CI_Controller {
/**
*
* Load related model to anime and load library :
* )Generate Genre : To regenerate the genre from database with linked link.
* )AZ Plugin : Create a pagination anime from alfabet filter.
* )Vote Episode : Create voting system for each episode.
*
*/
public function __construct(){
parent::__construct();
$this->load->model('anime_model');
$this->load->model('episode_model');
$this->load->model('counter_model');
$this->load->model('hosting_model');
$this->load->library('generate_genres');
$this->load->library('az_plugin');
$this->load->library('Vote_episode');
}
/**
* Function viewAnime($permalink)
*
* Show selected anime data with the same @permalink
*
* Parameters:
* @permalink (String)
*
* return html
*
*/
public function viewAnime($permalink){
/**
* Get title website from database with the same parameter.
*
* @title (Object)
*
*/
$title = $this->config_model->select_by_function('SITE_TITLE')->row();
/**
* Get data anime from selected @permalink
*
* Paremeters:
* @permalink (String)
* @rate (String) Filter by rating_kode anime such as : PG, PG-13,or R
*
*/
$info['anime'] = $this->anime_model->select_by_permalink($permalink, $rate = null)->row();
/**
* Condition when selected data anime not found
* Show Error Code 404
*/
if(empty($info['anime'])):
show_404();
endif;
/**
* Define variable @data (array) that need to be used in header
* Configuring meta tag header
*
*/
$data['website'] = $title->content;
$data['title'] = $info['anime']->title_anime.' | '.$title->content;
$data['description'] = character_limiter(strip_tags($info['anime']->synopsis), 150, '...');
$data['keywords'] = "download anime ".$info['anime']->title_anime.", streaming anime ".$info['anime']->title_anime;
/**
* Define variable @info (array) that need to be used in content
* Configuring what you need to show the information of anime.
*
*/
/**
* Get rating data from idanime
*
* Parameters:
* @item_id (int)
*
*/
$info['rating'] = $this->rating->get($item_id = $info['anime']->idanime);
/**
* Get Episode Anime from exists idanime return an object
*
* Parameters:
* @idanime (int)
*
*/
$info['episodes'] = $this->episode_model->select_by_idanime($idanime = $info['anime']->idanime)->result();
$info['vote_episode'] = $this->vote_episode;
/**
* Count the genre @tags (String)
* return @genre_count (int)
*/
$genre_count = $this->generate_genres->countTags($tags = $info['anime']->genres);
/**
* Recreate genre from database with linked link for each genre.
*
* Return @genre_link (Array)
*
*/
$info['genre_link'] = $this->generate_genres->get_tag_link($info['anime']->genres, $genre_count);
$this->load->view('header', $data);
$this->load->view('templates/single-anime', $info);
$this->load->view('footer', $data);
}
/**
* Function browse()
*
* Create a page for easy browse anime title
*
*/
public function browse(){
/**
* Get title website from database with the same parameter.
*
* @title (Object)
*
*/
$title = $this->config_model->select_by_function('SITE_TITLE')->row();
/**
* Fetch all data anime from database
*
* return @anime (Object)
*/
$info['anime'] = $this->anime_model->select_all()->result();
/**
* Condition when selected data anime not found
* Show Error Code 404
*/
if(empty($info['anime'])):
show_404();
endif;
/**
* Define variable @data (array) that need to be used in header
* Configuring meta tag header
*
*/
$desc = 'Cari anime yang anda sukai dengan menjelajahi dimensi anime.';
$data['website'] = $title->content;
$data['title'] = 'Jelajahi Anime | '.$title->content;
$data['description'] = character_limiter($desc, 150, '...');
$data['keywords'] = null;
/**
* Define variable @info (Object) that need to use within template.
*
*/
$info['az_plugin'] = $this->az_plugin;
$info['rating'] = $this->rating;
$this->load->view('header', $data);
$this->load->view('templates/browse-anime', $info);
$this->load->view('footer', $data);
}
/**
* Function decodeStream($hashcode)
*
* Decode base64 from @hashcode and return @newdata (String)
* To get url link download or streaming
*
* Parameters:
* @hashcode (String)
*
*/
private function decodeStream($hashcode){
/**
* Decode @hashcode based base64
*/
$decodeCode = base64_decode($hashcode);
/**
* Explode @decodeCode to split data domain with code embed.
*/
$url = explode('/',$decodeCode);
/**
* Switch @url[2] (String) domain name
* str_replace() used to replace/combine the domain with embed code.
*/
switch($url[2]):
case'www.mp4upload.com';
case'mp4upload.com';
$http = "mp4upload.com";
$replace = str_replace($http."/", $http."/embed-", $decodeCode);
$newdata = $replace.".html";
break;
case'upload4free.co';
$http = "upload4free.co";
$replace = str_replace($http."/", $http."/embed-", $decodeCode);
$newdata = $replace."-648x460.html";
break;
default:
$newdata = null;
break;
endswitch;
return $newdata;
}
/**
* Function viewEpisode($permalink, $episode)
*
* Show episode anime to stream with selected @permalink and @episode from database
*
* Parameters:
* @permalink (String)
* @episode (int)
*/
public function viewEpisode($permalink, $episode){
/**
* Get title website from database with the same parameter.
*
* @title (Object)
*
*/
$title = $this->config_model->select_by_function('SITE_TITLE')->row();
/**
* Get data anime from selected @permalink
*
* Paremeters:
* @permalink (String)
*
* return @anime (Object)
*/
$info['anime'] = $this->anime_model->select_by_permalink($permalink)->row();
/**
* Get data episode from @idanime
*
* Paremeters:
* @idanime (int)
* @episode (int)
*
* return @sAnime (Object)
*/
$info['sAnime'] = $this->episode_model->select_by_episode($info['anime']->idanime, $episode)->result();
$info['hashcode'] = "0"; // Define variable @info[hashcode] and store default value with 0
/**
* Condition when selected data anime not found
* Show Error Code 404
*/
if(empty($info['sAnime'])):
show_404();
endif;
/**
* Loop data episode from @sAnime as @hosting
* return @info[eAnime] (Object)
*/
foreach($info['sAnime'] as $hosting):
/**
* Condition to check domain is exists in database or not
* with status_streaming is equal 1
* If equal then store the data in @info[hashcode] (String)
*/
if($this->hosting_model->checkHosting($hosting->namahosting)->row()->status_streaming == 1):
$info['eAnime'] = $hosting;
$info['hashcode'] = Anime::decodeStream($hosting->hashcode);
break;
else:
$info['eAnime'] = $hosting;
endif;
endforeach;
/**
* Condition when @info[hashcode] is empty or not set
* redirected to new url download anime
*/
if(empty($info['hashcode'])):
redirect('download/'.$info['anime']->permalink.'/'.$info['eAnime']->episode.'/');
endif;
/**
* Fetch another episode who have the same episode and idanime
*/
$info['mirror'] = $info['sAnime'] = $this->episode_model->select_by_episode($info['anime']->idanime, $episode, true)->result();
/**
* Define variable @data (array) that need to be used in header
* Configuring meta tag header
*
*/
$desc = "Free streaming anime ".$info['anime']->title_anime.' episode '.$info['eAnime']->episode;
$data['website'] = $title->content;
$data['title'] = $info['anime']->title_anime.' Episode '.$info['eAnime']->episode.' | '.$title->content;
$data['description'] = character_limiter($desc, 150, '...');
$data['keywords'] = "streaming ".$info['anime']->title_anime.", download anime ".$info['anime']->title_anime;
/**
* Define variable @info (Object) that need to use within template.
*
*/
$info['rating'] = $this->rating->get($info['anime']->idanime);
$genre_count = $this->generate_genres->countTags($info['anime']->genres);
$info['genre_link'] = $this->generate_genres->get_tag_link($info['anime']->genres, $genre_count);
$this->load->view('header', $data);
$this->load->view('templates/single-episode', $info);
$this->load->view('footer', $data);
}
/**
* Function viewMirror($permalink, $episode, $mirrorid)
*
* Get episode anime with the same anime and episode
*
* Parameters:
* @permalink (String)
* @episode (int)
* @mirrorid (int)
*/
public function viewMirror($permalink, $episode, $mirrorid){
/**
* Get title website from database with the same parameter.
*
* @title (Object)
*
*/
$title = $this->config_model->select_by_function('SITE_TITLE')->row();
/**
* Get data anime from selected @permalink
*
* Paremeters:
* @permalink (String)
*
* return @anime (Object)
*/
$info['anime'] = $this->anime_model->select_by_permalink($permalink)->row();
/**
* Define @mirror (Array)
* @mirror keys:
* get, and parentid
*/
$mirror = array(
'get' => true,
'parentid' => $mirrorid
);
/**
* Fetch another episode who have the same episode and idanime
*
* Parameters:
* @idanime (int)
* @episode (int)
* @mirror (int)
* return @info[sAnime] (Object)
*/
$info['sAnime'] = $this->episode_model->select_by_episode($info['anime']->idanime, $episode, $mirror)->row();
$info['hashcode'] = "0"; // Define variable @info[hashcode] and store default value with 0
/**
* Condition when the mirror link is found within database
*/
if(!empty($info['sAnime'])):
/**
* Condition to check domain is exists in database or not
* with status_streaming is equal 1
* If equal then store the data in @info[hashcode] (String)
*/
if($this->hosting_model->checkHosting($info['sAnime']->namahosting)->row()->status_streaming == 1):
$info['eAnime'] = $info['sAnime'];
$info['hashcode'] = Anime::decodeStream($info['sAnime']->hashcode);
else:
show_404();
endif;
endif;
/**
* Condition when @info[hashcode] is empty or not set
* redirected to new url download anime
*/
if(empty($info['hashcode'])):
redirect('download/'.$info['anime']->permalink.'/'.$info['sAnime']->episode.'/');
endif;
/**
* Fetch another episode who have the same episode and idanime
*/
$info['mirror'] = $info['sAnime'] = $this->episode_model->select_by_episode($info['anime']->idanime, $episode, true)->result();
/**
* Define variable @data (array) that need to be used in header
* Configuring meta tag header
*
*/
$data['website'] = $title->content;
$data['title'] = $info['anime']->title_anime.' Episode '.$info['eAnime']->episode.' | '.$title->content;
$data['description'] = character_limiter($info['anime']->synopsis, 150, '...');
$data['keywords'] = null;
/**
* Define variable @info (Object) that need to use within template.
*
*/
$info['rating'] = $this->rating->get($info['anime']->idanime);
$genre_count = $this->generate_genres->countTags($info['anime']->genres);
$info['genre_link'] = $this->generate_genres->get_tag_link($info['anime']->genres, $genre_count);
$this->load->view('header', $data);
$this->load->view('templates/single-episode', $info);
$this->load->view('footer', $data);
}
} | gpl-2.0 |
RAeschimann/bergauf-app | bergauf/app/home/directives/swisstopo-map-directive.ts | 1512 | ///<reference path='../../../typings/tsd.d.ts' />
module SwisstopoMap {
'use strict';
/**
* @ngdoc directive
* @name home.directive:swisstopoMap
* @restrict EA
* @element
*
* @description
*
* @example
<example module="home">
<file name="index.html">
<swisstopo-map></swisstopo-map>
</file>
</example>
*
*/
angular
.module('home')
.directive('swisstopoMap', swisstopoMap);
function swisstopoMap($timeout): ng.IDirective {
return {
restrict: 'EA',
scope: {},
templateUrl: 'home/directives/swisstopo-map-directive.tpl.html',
replace: false,
controllerAs: 'swisstopoMap',
controller: function () {
var vm = this;
vm.name = 'swisstopoMap';
},
link: function (scope: ng.IScope, element: JQuery, attrs: any) {
/*jshint unused:false */
/*eslint "no-unused-vars": [2, {"args": "none"}]*/
/*
$timeout(function () {
var y = galleryDetail.gallery.map.y;
var x = galleryDetail.gallery.map.x;
console.log('y: ' + y);
console.log('x: ' + x);
var layer = ga.layer.create('ch.swisstopo.pixelkarte-farbe');
var map = new ga.Map({
target: 'map',
layers: [layer],
view: new ol.View({
resolution: 500,
center: [y,x]
center: [712785.19,190993.05]
})
});
}, 1000);
*/
}
};
}
}
| gpl-2.0 |
TOMIGalway/cmoct-sourcecode | src/com/joey/software/link/Memory.java | 1560 | /*******************************************************************************
* Copyright (c) 2012 joey.enfield.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* joey.enfield - initial API and implementation
******************************************************************************/
package com.joey.software.link;
import java.io.IOException;
import javax.swing.UnsupportedLookAndFeelException;
import com.joey.software.MultiThreadCrossCorrelation.CrossCorrProgram;
public class Memory
{
public static void main(String input[])
{
allocateMemory();
}
public static void allocateMemory()
{
try
{
CrossCorrProgram.main(new String[]{""});
} catch (ClassNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| gpl-2.0 |
nhikieuvn2012/price4limo | wp-content/themes/thesis_183/lib/functions/document.php | 3627 | <?php
function thesis_redirect() {
global $wp_query;
if ($wp_query->is_singular) {
$redirect = get_post_meta($wp_query->post->ID, 'thesis_redirect', true);
if ($redirect) {
wp_redirect($redirect, 301);
exit;
}
}
}
function thesis_feed_url() {
global $thesis_site;
$feed_url = ($thesis_site->head['feed']['url']) ? stripslashes($thesis_site->head['feed']['url']) : get_bloginfo(get_default_feed() . '_url');
return apply_filters('thesis_feed_url', $feed_url);
}
function thesis_body_classes() {
global $thesis_site;
$browser = $_SERVER['HTTP_USER_AGENT'];
// custom stylesheet
$classes[] = 'custom';
// Generate per-page classes
if (is_page() || is_single()) {
global $post;
$custom_slug = get_post_meta($post->ID, 'thesis_slug', true);
$deprecated_custom_slug = get_post_meta($post->ID, thesis_get_custom_field_key('slug'), true);
if (is_page())
$classes[] = $post->post_name;
if ($custom_slug)
$classes[] = $custom_slug;
elseif ($deprecated_custom_slug)
$classes[] = $deprecated_custom_slug;
}
elseif (is_category()) {
global $wp_query;
$classes[] = 'cat_' . $wp_query->query_vars['category_name'];
}
elseif (is_tag()) {
global $wp_query;
$classes[] = 'tag_' . $wp_query->query_vars['tag'];
}
elseif (is_author()) {
$author = thesis_get_author_data(get_query_var('author'));
$classes[] = $author->user_nicename;
}
elseif (is_day())
$classes[] = 'daily ' . strtolower(get_the_time('M_d_Y'));
elseif (is_month())
$classes[] = 'monthly ' . strtolower(get_the_time('M_Y'));
elseif (is_year())
$classes[] = 'year_' . strtolower(get_the_time('Y'));
$classes = apply_filters('thesis_body_classes', $classes);
if (is_array($classes))
$classes = implode(' ', $classes);
if ($classes)
return ' class="' . $classes . '"';
}
function thesis_title_and_tagline() {
global $thesis_design;
if ($thesis_design->display['header']['title'] || $_GET['template']) {
if (!$thesis_design->display['header']['tagline'] && (is_home() || is_front_page()))
echo "\t\t<h1 id=\"logo\"><a href=\"" . get_bloginfo('url') . "\">" . get_bloginfo('name') . "</a></h1>\n";
else
echo "\t\t<p id=\"logo\"><a href=\"" . get_bloginfo('url') . "\">" . get_bloginfo('name') . "</a></p>\n";
}
if ($thesis_design->display['header']['tagline'] || $_GET['template']) {
if (is_home() || is_front_page())
echo "\t\t<h1 id=\"tagline\">" . get_bloginfo('description') . "</h1>\n";
else
echo "\t\t<p id=\"tagline\">" . get_bloginfo('description') . "</p>\n";
}
}
function thesis_404_title() {
_e('You 404’d it. Gnarly, dude.', 'thesis');
}
function thesis_404_content() {
?>
<p><?php _e('Surfin’ ain’t easy, and right now, you’re lost at sea. But don’t worry; simply pick an option from the list below, and you’ll be back out riding the waves of the Internet in no time.', 'thesis'); ?></p>
<ul>
<li><?php _e('Hit the “back” button on your browser. It’s perfect for situations like this!', 'thesis'); ?></li>
<li><?php printf(__('Head on over to the <a href="%s" rel="nofollow">home page</a>.', 'thesis'), get_bloginfo('url')); ?></li>
<li><?php _e('Punt.', 'thesis'); ?></li>
</ul>
<?php
}
function thesis_admin_link() {
global $thesis_design;
if ($thesis_design->display['admin']['link'] || $_GET['preview']) echo "\t\t<p><a href=\"" . admin_url() . '">' . __('WordPress Admin', 'thesis') . "</a></p>\n";
}
function thesis_ie_clear($output = true) {
$ie_clear = "<!--[if lte IE 8]>\n<div id=\"ie_clear\"></div>\n<![endif]-->\n";
if ($output) echo $ie_clear;
else return $ie_clear;
} | gpl-2.0 |
bmcage/stickproject | stick/bednet/bednetmodel.py | 13357 | #
# Copyright (C) 2010 B. Malengier
# Copyright (C) 2010 P.Li
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
upscaling to fabric1d domain
"""
#-------------------------------------------------------------------------
#
# Global Imports
#
#-------------------------------------------------------------------------
from __future__ import division
import os.path
import sys
import numpy as np
import scipy as sp
from scipy import integrate
from scipy.integrate import quad
import matplotlib.pyplot as plt
import pylab
import sets
import time
import math
import fipy
#-------------------------------------------------------------------------
#
# Local Imports
#
#-------------------------------------------------------------------------
import stick.const as const
import stick.lib.utils.utils as utils
import stick.lib.utils.gridutils as GridUtils
from stick.yarn.config import YarnConfigManager
from stick.yarn1d.yarn1dmodel import Yarn1DModel
ABSORPTION = False
#-------------------------------------------------------------------------
#
# DiffusionModel-fabric1d class
#
#-------------------------------------------------------------------------
class Bednet(object):
"""
Fabirc2dUpscaling is a special diffusion model to calculate the concentration of
a volatile outside the fabric. This upscaling method is simple with the equation:
C_outside = C_yarn * R_yarn/d_distance
"""
def __init__(self, config):
self.cfg = config
self.verbose = self.cfg.get('general.verbose')
self.time_period = self.cfg.get('time.time_period')
self.delta_t = self.cfg.get('time.dt')
self.timesteps = int((self.time_period*(1.+self.delta_t*1e-6)) // self.delta_t)
self.times = np.linspace(0, self.time_period, self.timesteps + 1)
#set correct delta_t
self.delta_t = self.times[1]-self.times[0]
if self.verbose:
print "Timestep used in bednet model:", self.delta_t
self.initconc = self.cfg.get('initial.init_conc')
self.dx = self.cfg.get('domain.dx')
self.dy = self.cfg.get('domain.dy')
self.nvertyarns = self.cfg.get('domain.nr_vert_yarns')
self.nhoryarns = self.cfg.get('domain.nr_hor_yarns')
self.diff_coef = self.cfg.get('diffusion.diff_coef')
self.saturation_conc = self.cfg.get('active_component.saturation_conc')
self.treshold = self.cfg.get('active_component.treshold_effect')
x0 = self.cfg.get('observer.x0')
self.x0 = np.empty(len(x0)+1, float)
self.x0[1:] = x0[:]
#we set a distance for the yarn bc
EXTFRAC = 1.
self.cfg_yarn = []
for filename in self.cfg.get('sample.yarn_config'):
if not os.path.isabs(filename):
filename = os.path.normpath(os.path.join(
os.path.dirname(self.cfg.filename), filename))
self.cfg_yarn.append(YarnConfigManager.get_instance(filename))
#set values from the yarn on this inifile
print 'time', self.time_period
self.cfg_yarn[-1].set("time.time_period", self.time_period)
self.cfg_yarn[-1].set("boundary.dist_conc_out", float(self.x0[0]))
self.cfg_yarn[-1].set("boundary.D_out", self.diff_coef)
self.cfg_yarn[-1].set("boundary.conc_out", self.initconc)
self.cfg_yarn[-1].set("domain.useextension", True)
##TODO How much overlap region? Take one yarn radius for now
self.cfg_yarn[-1].set("domain.extensionfraction", EXTFRAC)
radyarn = self.cfg_yarn[-1].get("domain.yarnradius")
for conf in self.cfg_yarn:
assert radyarn == self.cfg_yarn[-1].get("domain.yarnradius")
# we need concentration at half of the extra zone
self.x0[0] = radyarn + EXTFRAC*radyarn/2
self.overlapsize = EXTFRAC*radyarn
self.overlaparea = np.pi * (np.power(radyarn+self.overlapsize,2)
- np.power(radyarn,2))
#create yarn models
self.yarn_models = []
for cfg in self.cfg_yarn:
self.yarn_models.append(Yarn1DModel(cfg))
self.nr_models = len(self.yarn_models)
#some memory
self.source_mass = np.empty((self.nr_models, self.timesteps + 1), float)
#plot the result every few seconds so outcome becomes visible during calculations
self.plotevery = self.cfg.get("plot.plotevery")
def init_yarn(self):
self.yarn_mass = [0] * len(self.yarn_models)
self.tstep = 0
for ind, model in enumerate(self.yarn_models):
model.do_yarn_init()
if model.bound_type != 0 :
print ' ***********************************************'
print ' ****** WARNING: Boundary condition not diffusion flux,'\
'\n so yarn does not consider the fabric !!'
print ' ***********************************************'
self.yarn_mass[ind] = model.calc_mass(model.init_conc)
# no mass released at start time
self.source_mass[ind, self.tstep] = 0
def __loop_over_yarn(self, nryarns, dx):
x0 = self.x0
x02 = np.power(x0[:], 2)
factor = 4 * self.diff_coef
n = 0
termV = np.zeros(len(x0),float)
expn1V = np.empty(len(x0),float)
expn2V = np.empty(len(x0),float)
sol = 0
#determine max timestep to take into account in the summation
# After 100 sec we assume no longer influence
maxtimestep = int(100 / self.delta_t)
while n <= nryarns:
RV = x02 + n*n*dx*dx
#determine first timestep to take into account
firsttimestep = int(np.max(RV*1e-6/(factor*self.delta_t)))
firsttimestep = max(firsttimestep, self.tstep-maxtimestep)
for ttt in np.arange(int(firsttimestep), self.tstep):
tt = ttt+1
for ttype in np.arange(self.nr_models):
# TODO: this should be dx/dy per yarn ttype!!
#integralV = np.empty(len(x0),float)
#integralH = np.empty(len(x0),float)
k=1
#for ind, xstart in enumerate(self.x0):
#print 'x0', x0, 'delta_t', self.delta_t, 'tt', tt
while k <= tt:
z2V = -RV/(factor*(self.times[tt]-(k-1)*self.delta_t))
for i, z2 in enumerate(z2V):
expn2V[i] = sp.special.expi(z2)
if k == tt:
expn1V[i] = 0.
else:
expn1V[i] = sp.special.expi(\
z2 * (self.times[tt]-(k-1)*self.delta_t)\
/(self.times[tt]-k*self.delta_t))
termV += self.source_mass[ttype,tt] \
* (expn1V-expn2V) / (factor*np.pi)
k += 1
#print 'termV', termV
#raw_input()
solstep = (
self.source_mass[ttype,0] /(factor*np.pi*self.times[tt])
* np.exp(-RV/(factor*self.times[tt])) + termV
)
sol += solstep
n += 1
return sol
def solve_timestep(self, t):
print "solve timestep", t
self.tstep += 1
print 'tstep', self.tstep
#raw_input()
# 1. step one, solve the yarn model, calculate the mass coming out of one yarn and calculate
# the corresponding concentration by dividing by the volume of a yarn pi Ry^2
for ttype, model in enumerate(self.yarn_models):
rt, rety = model.do_yarn_step(t)
#print 'rety',rety
#raw_input()
tmp = model.calc_mass(rety)
#V = np.pi * np.power(model.end_point, 2)
self.source_mass[ttype, self.tstep] = self.yarn_mass[ttype] - tmp
#self.source_mass[ttype, self.tstep] /= V
print 'mass yarn now', tmp, 'prev', self.yarn_mass[ttype], 'release', self.source_mass[ttype, self.tstep]
self.yarn_mass[ttype] = tmp
if ABSORPTION != True:
if self.source_mass[ttype, self.tstep] < 0.:
if abs(self.source_mass[ttype, self.tstep]) < 1e-7:
self.source_mass[ttype, self.tstep] = 0.
print 'WARNING: small negative release, set to 0'
else:
raise NotImplementedError, 'source must be positive, negative not supported'
##raw_input('Continue press ENTER')
# 2. step two, solve the bednet model
# to obtain value near yarn, and at observer
# we know that self.source_mass[ttype] has been released since
# last step
# concentration is a consequence of all previous releases, so sum
# over all times, and compute contribution of that moment.
self.sol[self.tstep, :] = 0.
solV = self.__loop_over_yarn(self.nvertyarns, self.dx)
print 'solV', solV
solH = self.__loop_over_yarn(self.nhoryarns, self.dy)
print 'solH', solH
self.sol[self.tstep, :] = solV + solH
print 'solution', self.sol[self.tstep,:]
# 3. for next timestep, we need to set correct boundary condition
# on the yarn level
for ind, model in enumerate(self.yarn_models):
#the source mass is what was present in the overlap
massoverlapold = model.calc_mass_overlap(model.step_old_sol)
#the new mass there we approximate
massoverlapnew = self.sol[self.tstep, 0] * self.overlaparea
massremoved = massoverlapold - massoverlapnew
print 'prev mass overlap', massoverlapold, 'new', massoverlapnew, 'removed:', massremoved
#based on removed, we set a source term in the overlap zone of
# of the yarn
model.source_overlap = -massremoved / self.tstep / self.overlaparea
#print 'prev boundary conc', model.boundary_conc_out, self.sol[self.tstep-1, 0]
#model.boundary_conc_out = self.sol[self.tstep, 0]
#print 'boundary conc yarn', model.boundary_conc_out
fipy.dump.write({
'time': self.tstep,
'xpos': self.x0,
'concentration': self.sol[self.tstep, :] },
filename=utils.OUTPUTDIR + os.sep + 'bednet_sol_%08d.gz'%(self.tstep) ,
extension='.gz')
def view_sol(self, times, sol):
#maxv = np.max(self.sol)
#minv = np.min(self.sol)
#print 'max', maxv, minv
#self.plottimes = np.arange(self.times[0],self.times[-1]+1,self.plotevery)
plt.ion()
for ind, pos in enumerate(self.x0[1:]):
plt.rc("font", family="serif")
plt.rc("font", size=10)
width = 4.5 #width in inches
height = 1.4 #height in inches
plt.rc("figure.subplot", left=(50/72.27)/width)
plt.rc("figure.subplot", right=(width-10/72.27)/width)
plt.rc("figure.subplot", bottom=(14/72.27)/height)
plt.rc("figure.subplot", top=(height-7/72.27)/height)
plt.figure(ind)
plt.gca().set_xlabel('Time [s]')
plt.gca().set_ylabel('Concentration [$\mu$g/mm$^3$]')
#plt.gca().yaxis.set_major_formatter(pylab.FormatStrFormatter('%e'))
plt.title('Concentration at position %g mm' % pos)
plt.plot(self.times, self.sol[:, ind+1])
#plt.ylim(0, maxv*1.1)
plt.plot(self.times, np.ones(len(self.times)) * self.treshold, 'b--')
plt.show()
plt.savefig(utils.OUTPUTDIR + os.sep
+ 'AIconc_%03.1f_mm' % pos + const.FIGFILEEXT)
#fipy.dump.write({plt.plot},filename=utils.OUTPUTDIR + os.sep + 'bednetconc%08.4f.png' % t)
def init_bednet(self):
self.sol = np.empty((self.timesteps+1, len(self.x0)), float)
self.sol[0, :] = 0
self.init_yarn()
def run(self, wait=False):
self.init_bednet()
for t in self.times[1:]:
self.solve_timestep(t)
self.view_sol(self.times,self.sol)
#self.view_sol(self.times,self.sol)
if wait:
raw_input("Finished bednet run")
| gpl-2.0 |
cherishqq/wuguangguang | wp-content/plugins/seopress/includes/lib/wordpress/functions.php | 1958 | <?php
/**
* SeoPress functions
*
* @package SeoPress
* @author Sven Lehnert, Sven Wagener
* @copyright Copyright (C) Themekraft.com
**/
if(!function_exists('get_blog_option')){
function get_blog_option( $blog_id, $option_name, $default = false ) {
return get_option( $option_name, $default );
}
}
if(!function_exists('add_blog_option')){
function add_blog_option( $blog_id, $option_name, $option_value ) {
return add_option( $option_name, $option_value );
}
}
if(!function_exists('update_blog_option')){
function update_blog_option( $blog_id, $option_name, $option_value ) {
return update_option( $option_name, $option_value );
}
}
function is_min_wp($version){
return version_compare($GLOBALS['wp_version'], $version . 'alpha', '>=');
}
function sp_plugin_row($file){
if ( plugin_basename(__FILE__) != $file ) {
return;
}
echo '<form action="plugins.php" method="post">';
// wp_nonce_field('_wpseo_license_nonce');
echo '<tr>';
echo '<td colspan="';
echo(is_min_wp('2.6') ? (is_min_wp('2.8') ? 2 : 3) : 2);
echo '" class="fade"></td>';
echo '<td colspan="';
echo(is_min_wp('2.6') ? (is_min_wp('2.8') ? 1 : 2) : 3);
echo 'class="fade">';
echo '<label for="themekraft_username"><strong>' . __('Themekraft.com', 'seopress') . '</strong> ' . __('Username', 'seopress') . '</label> ';
echo '<input type="text" name="themekraft_username" /> ';
echo '<label for="themekraft_password">' . __('Password', 'seopress') . '</label> ';
echo '<input type="text" name="seopress_license_key" /> ';
echo '<input type="submit" name="seopress_submit" value="' . __('login', 'wpseo') . '" class="button-secondary action" />';
echo '</td></tr></form>';
}
// add_action('after_plugin_row', 'sp_plugin_row');
function my_plugin_notices(){
echo '<div class="updated fade"><p>';
_e('Please verify your serial of SeoPress', 'seopress');
echo '</p></div>';
}
// add_action('admin_notices', 'my_plugin_notices');
?> | gpl-2.0 |
wp-plugins/breezing-forms | platform/administrator/components/com_breezingforms/admin/element.html.php | 125013 | <?php
/**
* BreezingForms - A Joomla Forms Application
* @version 1.8
* @package BreezingForms
* @copyright (C) 2008-2012 by Markus Bopp
* @license Released under the terms of the GNU General Public License
**/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
require_once($ff_compath.'/facileforms.process.php');
jimport('joomla.version');
$version = new JVersion();
if(version_compare($version->getShortVersion(), '1.6', '>=')){
echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.BF_FOLDER.'/platform/administrator/components/com_breezingforms/admin/bluestork.fix.css" type="text/css" />';
}
class HTML_facileFormsElement
{
function newitem($option, $pkg, $form, $page)
{
$mainframe = JFactory::getApplication();
$ff_mossite = JURI::base();
?>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
<script type="text/javascript" src="<?php echo $ff_mossite; ?>/components/com_breezingforms/libraries/js/overlib_mini.js"></script>
<form action="index.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<table cellpadding="4" cellspacing="1" border="0" class="adminform" style="width:300px;">
<tr><th colspan="5" class="title">BreezingForms - <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NEWTYPE'); ?></th></tr>
<tr>
<td></td>
<td valign="top">
<fieldset><legend><strong><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_STATICS'); ?></strong></legend>
<table cellpadding="4" cellspacing="1" border="0" class="adminform">
<tr><td nowrap><input type="radio" id="newtype1" name="newtype" value='Static Text/HTML' checked="checked"/><label for="newtype1"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_STATICTEXT'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype2" name="newtype" value='Rectangle'/><label for="newtype2"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RECTANGLE'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype3" name="newtype" value='Image'/><label for="newtype3"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_IMAGE'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype4" name="newtype" value='Tooltip'/><label for="newtype4"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TOOLTIP'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype5" name="newtype" value='Captcha'/><label for="newtype4"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CAPTCHA'); ?></label></td></tr>
</table>
</fieldset>
<fieldset><legend><strong><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BUTTONS'); ?></strong></legend>
<table cellpadding="4" cellspacing="1" border="0" class="adminform">
<tr><td nowrap><input type="radio" id="newtype10" name="newtype" value='Regular Button'/><label for="newtype10"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_REGBUTTON'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype11" name="newtype" value='Graphic Button'/><label for="newtype11"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_GRAPHBUTTON'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype12" name="newtype" value='Icon'/><label for="newtype12"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ICON'); ?></label></td></tr>
</table>
</fieldset>
</td>
<td valign="top">
<fieldset><legend><strong><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_INPUTS'); ?></strong></legend>
<table cellpadding="4" cellspacing="1" border="0" class="adminform">
<tr><td nowrap><input type="radio" id="newtype20" name="newtype" value='Checkbox'/><label for="newtype20"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CHECKBOX'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype21" name="newtype" value='Radio Button'/><label for="newtype21"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RADIO'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype22" name="newtype" value='Text'/><label for="newtype22"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TEXT'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype23" name="newtype" value='Textarea'/><label for="newtype23"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TEXTAREA'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype24" name="newtype" value='Select List'/><label for="newtype24"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELECT'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype25" name="newtype" value='Query List'/><label for="newtype25"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_QUERYLIST'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype26" name="newtype" value='File Upload'/><label for="newtype26"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_UPLOAD'); ?></label></td></tr>
<tr><td nowrap><input type="radio" id="newtype27" name="newtype" value='Hidden Input'/><label for="newtype27"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_HIDDEN'); ?></label></td></tr>
</table>
</fieldset>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap colspan="3" style="text-align:right">
<input onclick="submitbutton('newedit');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_TOOLBAR_CONTINUE'), ENT_QUOTES, 'UTF-8'); ?>"/>
<input onclick="submitbutton('cancel');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_TOOLBAR_CANCEL'), ENT_QUOTES, 'UTF-8'); ?>"/>
</td>
<td></td>
</tr>
</table>
<input type="hidden" name="pkg" value="<?php echo $pkg; ?>" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="act" value="editpage" />
<input type="hidden" name="form" value="<?php echo $form; ?>" />
<input type="hidden" name="page" value="<?php echo $page; ?>" />
</form>
<?php
} // newitem
function displayType($type)
{
switch ($type) {
case 'Static Text/HTML': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_STATICTEXT'); break;
case 'Rectangle': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_RECTANGLE'); break;
case 'Image': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_IMAGE'); break;
case 'Tooltip': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_TOOLTIP'); break;
case 'Query List': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_QUERYLIST'); break;
case 'Regular Button': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_REGBUTTON'); break;
case 'Graphic Button': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_GRAPHBUTTON'); break;
case 'Icon': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_ICON'); break;
case 'Checkbox': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_CHECKBOX'); break;
case 'Radio Button': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_RADIO'); break;
case 'Select List': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELECT'); break;
case 'Text': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_TEXT'); break;
case 'Textarea': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_TEXTAREA'); break;
case 'File Upload': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_UPLOAD'); break;
case 'Hidden Input': $disptype = BFText::_('COM_BREEZINGFORMS_ELEMENTS_HIDDEN'); break;
default: $disptype = $type; break;
} // switch
return $disptype;
} // displayType
function edit($option, $tabpane, $pkg, &$row, &$lists)
{
global $ff_mossite, $ff_admsite, $ff_config;
$mainframe = JFactory::getApplication();
$ff_mossite = JURI::base();
$action = $row->id ? BFText::_('COM_BREEZINGFORMS_ELEMENTS_EDIT') : BFText::_('COM_BREEZINGFORMS_ELEMENTS_ADD');
$hasInit = false;
switch ($row->type) {
case 'Static Text/HTML':
case 'Rectangle':
case 'Image':
case 'Tooltip':
case 'Query List':
case 'Regular Button':
case 'Graphic Button':
case 'Icon':
case 'Captcha':
break;
default:
$hasInit = true;
} // switch
$hasAction = false;
switch ($row->type) {
case 'Static Text/HTML':
case 'Rectangle':
case 'Image':
case 'Tooltip':
case 'Query List':
case 'Hidden Input':
case 'Captcha':
break;
default:
$hasAction = true;
} // switch
$hasValidation = false;
switch ($row->type) {
case 'Static Text/HTML':
case 'Rectangle':
case 'Image':
case 'Tooltip':
case 'Query List':
case 'Regular Button':
case 'Graphic Button':
case 'Icon':
case 'Captcha':
break;
default:
$hasValidation = true;
} // switch
?>
<script type="text/javascript" src="<?php echo $ff_admsite; ?>/admin/areautils.js"></script>
<script type="text/javascript">
<!--
function checkIdentifier(value, name)
{
var invalidChars = /\W/;
var error = '';
if (value == '')
error += "<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ENTNAME'); ?>\n";
else
if (invalidChars.test(value))
error += "<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ENTIDENT'); ?>\n";
return error;
} // checkIdentifier
var bf_submitbutton = function(pressbutton)
{
var form = document.adminForm;
var error = '';
if (pressbutton != 'cancel') {
if (form.title.value == '')
error += "<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TITLEEMPTY'); ?>\n";
error += checkIdentifier(form.name.value, 'name');
} // if
if (error != ''){
alert(error);
} else {
<?php
if ($row->type=='Query List') echo "\t\t\t\tsaveQueryList();\n";
if ($row->type=='Static Text/HTML' && $ff_config->wysiwyg){
jimport( 'joomla.html.editor' );
$editor = JFactory::getEditor();
echo $editor->save( 'data1' );
}
?>
submitform( pressbutton );
} // if
}; // submitbutton
if(typeof Joomla != "undefined"){
Joomla.submitbutton = bf_submitbutton;
}
submitbutton = bf_submitbutton;
<?php
if ($row->type == 'Graphic Button' || $row->type == 'Icon') {
?>
function dispcaptiontext(value)
{
if(document.getElementById)
if(document.getElementById('captiontext'))
switch (value) {
case '0':
document.getElementById('captiontext').style.display = 'none';
break;
default:
document.getElementById('captiontext').style.display = '';
} // switch
} // dispcaptiontext
<?php
}
if ($row->type == 'Tooltip') {
?>
function disptooltipurl(value)
{
if(document.getElementById)
if(document.getElementById('tooltipurl'))
switch (value) {
case '0':
case '1':
document.getElementById('tooltipurl').style.display = 'none';
break;
default:
document.getElementById('tooltipurl').style.display = '';
} // switch
} // disptooltipurl
<?php
} // if tooltip
if ($row->type == 'Query List') {
?>
function loadQueryList()
{
var form = document.adminForm;
var text = trim(form.data1.value);
var rows = text.split('\n');
var rcnt = rows.length;
var r;
for (r = 0; r < rcnt; r++) rows[r] = trim(rows[r]);
if (rcnt > 0) form.border.value = rows[0];
if (rcnt > 1) form.cellspacing.value = rows[1];
if (rcnt > 2) form.cellpadding.value = rows[2];
if (rcnt > 3) form.trhclass.value = rows[3];
if (rcnt > 4) form.tr1class.value = rows[4];
if (rcnt > 5) form.tr2class.value = rows[5];
if (rcnt > 6) form.trfclass.value = rows[6];
if (rcnt > 7) form.tdfclass.value = rows[7];
if (rcnt > 8 && rows[8]!='') form.pagenav.options[rows[8]].selected = true;
qcolUnpack();
} // loadQueryList
function saveQueryList()
{
var form = document.adminForm;
form.data1.value =
trim(form.border.value) +'\n'+
trim(form.cellspacing.value) +'\n'+
trim(form.cellpadding.value) +'\n'+
trim(form.trhclass.value) +'\n'+
trim(form.tr1class.value) +'\n'+
trim(form.tr2class.value) +'\n'+
trim(form.trfclass.value) +'\n'+
trim(form.tdfclass.value) +'\n'+
trim(form.pagenav.value) +'\n';
qcolPack();
} // saveQueryList
function showpagenav(height)
{
if (parseInt(height))
document.getElementById('pagenavrow').style.display = '';
else
document.getElementById('pagenavrow').style.display = 'none';
} // showpagenav
function createQueryCode()
{
form = document.adminForm;
name = form.name.value;
if (name=='') {
alert('Please enter the element name first.');
return;
} // if
if (!confirm("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ASKCREATEQUERY'); ?>\n<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_EXISTAPP'); ?>")) return;
code =
"global $database;\n"+
"\n"+
"$database->setQuery(\n"+
" \"select id, name, username, email \".\n"+
" \"from #__users \".\n"+
" \"order by id\"\n"+
");\n"+
"$rows = $database->loadObjectList();\n";
oldcode = form.data2.value;
if (oldcode != '')
form.data2.value =
code+
"\n// -------------- <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_OLDBELOW'); ?> --------------\n\n"+
oldcode;
else
form.data2.value = code;
codeAreaChange(form.data2);
} // createQueryCode
function trim(s)
{
while (s.length>0 && (s.charAt(0)==' '||s.charAt(0)=='\n'||s.charAt(0)=='\r'))
s = s.substr(1,s.length-1);
while (s.length>0 && (s.charAt(s.length-1)==' '||s.charAt(s.length-1)=='\n'||s.charAt(s.length-1)=='\r'))
s = s.substr(0,s.length-1);
return s;
} // trim
function expstring(text)
{
text = trim(text);
var i;
var o = '';
for(i = 0; i < text.length; i++) {
c = text.charAt(i);
switch(c) {
case '&' : o += '\\x26'; break;
case '<' : o += '\\x3C'; break;
case '>' : o += '\\x3E'; break;
case '\'': o += '\\x27'; break;
case '\\': o += '\\x5C'; break;
case '"' : o += '\\x22'; break;
case '\n': o += '\\n'; break;
case '\r': o += '\\r'; break;
default: o += c;
} // switch
} // for
return o;
} // expstring
function htmlchars(text)
{
var i;
var o = '';
for(i = 0; i < text.length; i++) {
c = text.charAt(i);
switch(c) {
case '&' : o += '&'; break;
case '<' : o += '<'; break;
case '>' : o += '>'; break;
case '"' : o += '"'; break;
default: o += c;
} // switch
} // for
return o;
} // htmlchars
function impstring(text)
{
var str = '';
var ss = 0;
var s;
var tl = text.length;
var hexdigs = "0123456789abcdefABCDEF";
while (ss < tl) {
s = text.charAt(ss++);
if (s == '\\') {
if (ss < tl) s = text.charAt(ss++); else s = 0;
switch (s) {
case 0 : break;
case 'e' : str += '\33'; break;
case 't' : str += '\t'; break;
case 'r' : str += '\r'; break;
case 'n' : str += '\n'; break;
case 'f' : str += '\f'; break;
case 'x' : {
if (ss < tl) s = text.charAt(ss++); else s = 0;
var ch = '';
while (hexdigs.indexOf(s)>=0 && ch.length < 2) {
ch += s;
if (ss < tl) s = text.charAt(ss++); else s = 0;
} // while
while (ch.length < 2) ch = '0'+ch;
str += unescape('%'+ch);
if (s) ss--;
break;
}
default:
str += s;
} // switch
} else
str += s;
} // while
return str;
} // impstring
var qcolRows = new Array();
var qcolRowCnt = 0;
var qcolIndex = 0;
var qcolTitle = 0;
var qcolName = 1;
var qcolClass1 = 2;
var qcolClass2 = 3;
var qcolClass3 = 4;
var qcolWidth = 5;
var qcolWidthmd = 6;
var qcolThspan = 7;
var qcolThalign = 8;
var qcolThvalign = 9;
var qcolThwrap = 10;
var qcolAlign = 11;
var qcolValign = 12;
var qcolWrap = 13;
var qcolValue = 14;
var qcolSize = 15;
var qcolCellCheckbox = 0;
var qcolCellTitle = 1;
var qcolCellName = 2;
var qcolCellThattribs = 3;
var qcolCellAttributes = 4;
var qcolCellWidth = 5;
var qcolCellOrderup = 6;
var qcolCellOrderdown = 7;
var qcolCellCount = 8;
function qcolPack()
{
var r;
var text = '';
for (r = 0; r < qcolRowCnt; r++) {
var c;
var row = qcolRows[r];
for (c = 0; c < row.length; c++) {
if (c > 0) text += '&';
text += expstring(row[c]);
} // for
text += '\n';
} // for
document.adminForm.data3.value = text;
} // qcolPack
function qcolUnpack()
{
var text = trim(document.adminForm.data3.value);
var rows = text.split('\n');
var r;
qcolRowCnt = 0;
for (r = 0; r < rows.length; r++) {
if (rows[r] != '') {
var vals = rows[r].split('&');
var v;
for (v = 0; v < vals.length; v++)
vals[v] = impstring(vals[v]);
qcolRows[qcolRowCnt++] = vals;
} // if
} // for
qcolDisplay();
} // qcolUnpack
function qcolCheckAll(checked)
{
var r;
for (r = 0; r < qcolRowCnt; r++)
document.getElementById('cb'+r).checked = checked;
document.getElementById('qcolCbAll').checked = checked;
} // qcolCheckAll
function qcolSelects()
{
var r;
var s = 0;
for (r = 0; r < qcolRowCnt; r++)
if (document.getElementById('cb'+r).checked) s++;
return s;
} // qcolSelects
function qcolDisplay()
{
var form = document.QueryColForm;
var table = document.getElementById("qcolTable");
var oldRows = table.rows.length-1;
var r;
var skip = 0;
for (r = 0; r < qcolRowCnt; r++) {
// get or create table row
var row;
if (r >= oldRows) {
row = table.insertRow(r+1);
row.className = 'row'+(r%2+1);
var c;
for (c = 0; c < qcolCellCount; c++) {
row.insertCell(c);
row.cells[c].noWrap = 'true';
} // for
row.cells[qcolCellOrderup].style.textAlign = 'right';
} else
row = table.rows[r+1];
var data = qcolRows[r];
var title = data[qcolTitle];
if (title.length > 50) title = title.substr(0,47)+'...';
row.cells[qcolCellCheckbox].innerHTML = '<input type="checkbox" id="cb'+r+'" name="cb'+r+'" value="'+r+'"/>';
row.cells[qcolCellTitle ].innerHTML = '<a href="javascript:qcolEdit('+r+')">'+htmlchars(title)+'<\/a>';
row.cells[qcolCellName ].innerHTML = data[qcolName];
// header attribs
var attr = '';
var span = parseInt(data[qcolThspan]);
if (skip > 0 || span < 1) {
attr = '-';
skip--;
} else {
if (span > 1) {
attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SPAN'); ?>('+span+') ';
skip = span-1;
} // if
switch (data[qcolThalign]) {
case '1': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LEFT'); ?> '; break;
case '2': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CENTER'); ?> '; break;
case '3': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RIGHT'); ?> '; break;
case '4': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_JUSTIFY'); ?> '; break;
default : ;
} // switch
switch (data[qcolThvalign]) {
case '1': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TOP'); ?> '; break;
case '2': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MIDDLE'); ?> '; break;
case '3': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BOTTOM'); ?> '; break;
case '4': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BASELINE'); ?> '; break;
default : ;
} // switch
switch (data[qcolThwrap]) {
case '1': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NOWRAP'); ?>'; break;
default : ;
} // switch
} // if
row.cells[qcolCellThattribs].innerHTML = attr;
// data attribs
attr = '';
if (span < 1) {
attr = '-';
skip--;
} else {
switch (data[qcolAlign]) {
case '1': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LEFT'); ?> '; break;
case '2': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CENTER'); ?> '; break;
case '3': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RIGHT'); ?> '; break;
case '4': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_JUSTIFY'); ?> '; break;
default : ;
} // switch
switch (data[qcolValign]) {
case '1': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TOP'); ?> '; break;
case '2': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MIDDLE'); ?> '; break;
case '3': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BOTTOM'); ?> '; break;
case '4': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BASELINE'); ?> '; break;
default : ;
} // switch
switch (data[qcolWrap]) {
case '1': attr += '<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NOWRAP'); ?>'; break;
default : ;
} // switch
} // if
row.cells[qcolCellAttributes].innerHTML = attr;
// width
attr = '';
if (parseInt(data[qcolWidth]) > 0) {
attr += data[qcolWidth];
if (data[qcolWidthmd]=='1') attr += '%'; else attr += 'px';
} // if
row.cells[qcolCellWidth].innerHTML = attr;
// ordering
if (r > 0)
row.cells[qcolCellOrderup].innerHTML = '<a href="javascript:qcolOrderup('+r+')"><img src="components/com_breezingforms/images/icons/uparrow.png" alt="^" border="0"/><\/a>';
else
row.cells[qcolCellOrderup].innerHTML = '';
if (r < qcolRowCnt-1)
row.cells[qcolCellOrderdown].innerHTML = '<a href="javascript:qcolOrderdown('+r+')"><img src="components/com_breezingforms/images/icons/downarrow.png" alt="v" border="0"/><\/a>';
else
row.cells[qcolCellOrderdown].innerHTML = '';
} // for
for (r = oldRows; r > qcolRowCnt; r--) table.deleteRow(r);
qcolCheckAll(false);
} // qcolDisplay
function qcolEdit(index)
{
var form = document.QueryColForm;
qcolIndex = index;
var row = qcolRows[qcolIndex];
var c = 0;
form.colTitle.value = row[qcolTitle ];
form.colName.value = row[qcolName ];
form.colClass1.value = row[qcolClass1 ];
form.colClass2.value = row[qcolClass2 ];
form.colClass3.value = row[qcolClass3 ];
form.colWidth.value = row[qcolWidth ];
form.colWidthmd.value = row[qcolWidthmd ];
form.colThspan.value = row[qcolThspan ];
form.colThalign.value = row[qcolThalign ];
form.colThvalign.value = row[qcolThvalign];
form.colThwrap.value = row[qcolThwrap ];
form.colAlign.value = row[qcolAlign ];
form.colValign.value = row[qcolValign ];
form.colWrap.value = row[qcolWrap ];
form.colValue.value = row[qcolValue ];
document.getElementById('QueryColDialog').style.display = '';
form.colTitle.focus();
MM_swapImage('colSave','','images/save_f2.png',1);
MM_swapImgRestore();
MM_swapImage('colCancel','','images/cancel_f2.png',1);
MM_swapImgRestore();
} // qcolEdit
function qcolAdd()
{
var form = document.QueryColForm;
qcolIndex = qcolRowCnt;
form.colTitle.value = '';
form.colName.value = '';
form.colClass1.value = '';
form.colClass2.value = '';
form.colClass3.value = '';
form.colWidth.value = '';
form.colWidthmd.value = 0;
form.colThspan.value = 1;
form.colThalign.value = 0;
form.colThvalign.value = 0;
form.colThwrap.value = 0;
form.colAlign.value = 0;
form.colValign.value = 0;
form.colWrap.value = 0;
form.colValue.value = '\x3C?php return $value; ?\x3E';
document.getElementById('QueryColDialog').style.display = '';
form.colTitle.focus();
MM_swapImage('colSave','','images/save_f2.png',1);
MM_swapImgRestore();
MM_swapImage('colCancel','','images/cancel_f2.png',1);
MM_swapImgRestore();
} // qcolAdd
function qcolCopy()
{
if (!qcolSelects()) {
alert('<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELECTCOLUMNS'); ?>');
return;
} // if
var r;
var newcnt = qcolRowCnt;
for (r = 0; r < qcolRowCnt; r++) {
if (document.getElementById('cb'+r).checked) {
qcolRows[newcnt] = new Array();
var x;
for (x = 0; x < qcolRows[r].length; x++)
qcolRows[newcnt][x] = qcolRows[r][x];
newcnt++;
} // if
} // for
qcolRowCnt = newcnt;
qcolDisplay();
} // qcolCopy
function qcolDelete()
{
if (!qcolSelects()) {
alert('<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELECTCOLUMNS'); ?>');
return;
} // if
if (!confirm('<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ASKDELCOLUMNS'); ?>')) return;
var r;
for (r = qcolRowCnt-1; r >= 0; r--) {
if (document.getElementById('cb'+r).checked) {
var r2;
qcolRowCnt--;
for (r2 = r; r2 < qcolRowCnt; r2++) qcolRows[r2] = qcolRows[r2+1];
} // if
} // for
qcolDisplay();
} // qcolDelete
function qcolOrderup(index)
{
var row = qcolRows[index];
qcolRows[index] = qcolRows[index-1];
qcolRows[index-1] = row;
qcolDisplay();
} // qcolOrderup
function qcolOrderdown(index)
{
var row = qcolRows[index];
qcolRows[index] = qcolRows[index+1];
qcolRows[index+1] = row;
qcolDisplay();
} // qcolOrderdown
function qcolOk()
{
var form = document.QueryColForm;
var error = '';
if (form.colTitle.value == '')
error += "<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TITLEEMPTY'); ?>\n";
error += checkIdentifier(form.colName.value, 'name');
if (error != '') {
alert(error);
return;
} // if
document.getElementById("QueryColDialog").style.display = 'none';
if (qcolIndex >= qcolRowCnt) {
// add a new row to the table
qcolRows[qcolRowCnt++] = new Array(
form.colTitle.value,
form.colName.value,
form.colClass1.value,
form.colClass2.value,
form.colClass3.value,
form.colWidth.value,
form.colWidthmd.value,
form.colThspan.value,
form.colThalign.value,
form.colThvalign.value,
form.colThwrap.value,
form.colAlign.value,
form.colValign.value,
form.colWrap.value,
form.colValue.value
);
} else {
// udate existing row
var row = qcolRows[qcolIndex];
row[qcolTitle ] = form.colTitle.value,
row[qcolName ] = form.colName.value,
row[qcolClass1 ] = form.colClass1.value,
row[qcolClass2 ] = form.colClass2.value,
row[qcolClass3 ] = form.colClass3.value,
row[qcolWidth ] = form.colWidth.value,
row[qcolWidthmd ] = form.colWidthmd.value,
row[qcolThspan ] = form.colThspan.value,
row[qcolThalign ] = form.colThalign.value,
row[qcolThvalign] = form.colThvalign.value,
row[qcolThwrap ] = form.colThwrap.value,
row[qcolAlign ] = form.colAlign.value,
row[qcolValign ] = form.colValign.value,
row[qcolWrap ] = form.colWrap.value,
row[qcolValue ] = form.colValue.value
} // if
qcolDisplay();
} // qcolOk
function qcolCancel()
{
document.getElementById("QueryColDialog").style.display = 'none';
} // qcolCancel
<?php
} // if query list
if ($hasInit) {
?>
function dispinit(value)
{
if (document.getElementById('initexec'))
switch (value) {
case '1':
document.getElementById('initexec').style.display = '';
document.getElementById('initlib').style.display = '';
document.getElementById('initcode').style.display = 'none';
break;
case '2':
document.getElementById('initexec').style.display = '';
document.getElementById('initlib').style.display = 'none';
document.getElementById('initcode').style.display = '';
break;
default:
document.getElementById('initexec').style.display = 'none';
document.getElementById('initlib').style.display = 'none';
document.getElementById('initcode').style.display = 'none';
} // switch
} // dispinit
function createInitCode()
{
form = document.adminForm;
name = form.name.value;
if (name=='') {
alert('Please enter the element name first.');
return;
} // if
if (!confirm("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CREAINIT'); ?>\n<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_EXISTAPP'); ?>")) return;
code =
"function ff_"+name+"_init(element, condition)\n"+
"{\n"+
" switch (condition) {\n";
if (form.script1flag1.checked)
code +=
" case 'formentry':\n"+
" break;\n";
if (form.script1flag2.checked)
code +=
" case 'pageentry':\n"+
" break;\n";
code +=
" default:;\n"+
" } // switch\n"+
"} // ff_"+name+"_init\n";
oldcode = form.script1code.value;
if (oldcode != '')
form.script1code.value =
code+
"\n// -------------- <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_OLDBELOW'); ?> --------------\n\n"+
oldcode;
else
form.script1code.value = code;
codeAreaChange(form.script1code);
} // createInitCode
<?php
} // if hasInit
if ($hasAction) {
?>
function dispaction(value)
{
if(document.getElementById)
if(document.getElementById('actionact'))
switch (value) {
case '1':
document.getElementById('actionact').style.display = '';
document.getElementById('actionlib').style.display = '';
document.getElementById('actioncode').style.display = 'none';
break;
case '2':
document.getElementById('actionact').style.display = '';
document.getElementById('actionlib').style.display = 'none';
document.getElementById('actioncode').style.display = '';
break;
default:
document.getElementById('actionact').style.display = 'none';
document.getElementById('actionlib').style.display = 'none';
document.getElementById('actioncode').style.display = 'none';
} // switch
} // dispaction
function createActionCode()
{
form = document.adminForm;
name = form.name.value;
if (name=='') {
alert('Please enter the element name first.');
return;
} // if
if (!confirm("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CREAACTION'); ?>\n<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_EXISTAPP'); ?>")) return;
code =
"function ff_"+name+"_action(element, action)\n"+
"{\n"+
" switch (action) {\n";
if (form.script2flag1)
if (form.script2flag1.checked)
code +=
" case 'click':\n"+
" break;\n";
if (form.script2flag2)
if (form.script2flag2.checked)
code +=
" case 'blur':\n"+
" break;\n";
if (form.script2flag3)
if (form.script2flag3.checked)
code +=
" case 'change':\n"+
" break;\n";
if (form.script2flag4)
if (form.script2flag4.checked)
code +=
" case 'focus':\n"+
" break;\n";
if (form.script2flag5)
if (form.script2flag5.checked)
code +=
" case 'select':\n"+
" break;\n";
code +=
" default:;\n"+
" } // switch\n"+
"} // ff_"+name+"_action\n";
oldcode = form.script2code.value;
if (oldcode != '')
form.script2code.value =
code+
"\n// -------------- <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_OLDBELOW'); ?> --------------\n\n"+
oldcode;
else
form.script2code.value = code;
codeAreaChange(form.script2code);
} // createActionCode
<?php
} // if hasAction
if ($hasValidation) {
?>
function dispvalidation(value)
{
if(document.getElementById)
if(document.getElementById('validationlib'))
switch (value) {
case '1':
document.getElementById('validationmsg').style.display = '';
document.getElementById('validationlib').style.display = '';
document.getElementById('validationcode').style.display = 'none';
break;
case '2':
document.getElementById('validationmsg').style.display = '';
document.getElementById('validationlib').style.display = 'none';
document.getElementById('validationcode').style.display = '';
break;
default:
document.getElementById('validationmsg').style.display = 'none';
document.getElementById('validationlib').style.display = 'none';
document.getElementById('validationcode').style.display = 'none';
} // switch
} // dispvalidation
function createValidationCode()
{
form = document.adminForm;
name = form.name.value;
if (name=='') {
alert('Please enter the element name first.');
return;
} // if
if (!confirm("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CREAVALID'); ?>\n<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_EXISTAPP'); ?>")) return;
code =
"function ff_"+name+"_validation(element, message)\n"+
"{\n"+
" if (element_fails_my_test) {\n"+
" if (message=='') message = element.name+\" faild in my test.\\n\"\n"+
" ff_validationFocus(element.name);\n"+
" return message;\n"+
" } // if\n"+
" return '';\n"+
"} // ff_"+name+"_validation\n";
oldcode = form.script3code.value;
if (oldcode != '')
form.script3code.value =
code+
"\n// -------------- <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_OLDBELOW'); ?> --------------\n\n"+
oldcode;
else
form.script3code.value = code;
codeAreaChange(form.script3code);
} // createValidationCode
<?php
} // if hasValidation
if ($row->type == 'Select List') {
?>
function addOption()
{
form = document.SelectOptionForm;
form.optionText.value = '';
form.optionValue.value = '';
form.optionSelected[0].checked = true;
document.getElementById("SelectOptionDialog").style.display = '';
form.optionText.focus();
} // addOption
function okOption()
{
form = document.SelectOptionForm;
if (form.optionText.value=='') {
alert("Please enter a text.");
form.optionText.focus();
return;
} // if
data = document.adminForm.data2;
value = data.value;
if (value != '')
if (value.substr(value.length-1,1)!="\n")
value += "\n";
sel = '0;';
if (form.optionSelected[1].checked) sel = '1;';
value +=
sel +
form.optionText.value + ';' +
form.optionValue.value;
data.value = value;
form.optionText.value = '';
form.optionValue.value = '';
form.optionSelected[0].checked = true;
form.optionText.focus();
} // addOption
function quitOption()
{
document.getElementById("SelectOptionDialog").style.display = 'none';
} // addOption
<?php
}
?>
onload = function()
{
<?php
if ($row->type=='Query List') echo "\t\t\tloadQueryList();\n";
// because of mozilla browser problems, the widest elements must be shown first
$s1size = $s2size = $s3size = $ff_config->areasmall;
$nonbig = true;
if ($hasInit && $row->script1cond==2) {
echo "\t\t\tdispinit('2');\n";
$s1size = $ff_config->areamedium;
$nonbig = false;
} // if
if ($hasAction && $row->script2cond==2) {
echo "\t\t\tdispaction('2');\n";
if ($nonbig) {
$s2size = $ff_config->areamedium;
$nonbig = false;
} // if
} // if
if ($hasValidation && $row->script3cond==2) {
echo "\t\t\tdispvalidation('2');\n";
if ($nonbig) $s3size = $ff_config->areamedium;
} // if
if ($hasInit && $row->script1cond==1) echo "\t\t\tdispinit('1');\n";
if ($hasAction && $row->script2cond==1) echo "\t\t\tdispaction('1');\n";
if ($hasValidation && $row->script3cond==1) echo "\t\t\tdispvalidation('1');\n";
if (($row->type=='Graphic Button' || $row->type=='Icon') && $row->flag1!=0)
echo "\t\t\tdispcaptiontext('".$row->flag1."');\n";
if ($hasInit) echo "\t\t\tcodeAreaAdd('script1code', 'script1lines');\n";
if ($hasAction) echo "\t\t\tcodeAreaAdd('script2code', 'script2lines');\n";
if ($hasValidation) echo "\t\t\tcodeAreaAdd('script3code', 'script3lines');\n";
if ($row->type=='Query List') echo "\t\t\tcodeAreaAdd('data2', 'data2lines');\n";
switch ($tabpane) {
case 1:
case 2:
echo "\t\t\ttabPane1.setSelectedIndex($tabpane);\n";
break;
default:
echo "\t\t\tdocument.adminForm.title.focus();\n";
} // switch
?>
} // onload
//-->
</script>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
<script type="text/javascript" src="<?php echo $ff_mossite ?>/components/com_breezingforms/libraries/js/overlib_mini.js"></script>
<?php
if ($row->type == 'Select List') {
?>
<div id="SelectOptionDialog" style="position:absolute;top:380px;left:45%;z-index:100;display:none;">
<table cellpadding="4" cellspacing="1" border="0" class="adminform" style="width:350px">
<form name='SelectOptionForm' onsubmit='okOption();return false;'>
<tr><th colspan="4" class="title">BreezingForms - <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NEWSELOPT'); ?></th></tr>
<tr>
<td></td>
<td><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TEXT'); ?>:</td>
<td><input type="text" size="50" value="" name="optionText" class="inputbox"/></td>
<td></td>
</tr>
<tr>
<td></td>
<td><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_VALUE'); ?>:</td>
<td><input type="text" size="50" value="" name="optionValue" class="inputbox"/></td>
<td></td>
</tr>
<tr>
<td></td>
<td><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELECTED'); ?>:</td>
<td><?php echo JHTML::_('select.booleanlist', "optionSelected", "", 0); ?></td>
<td></td>
</tr>
<tr>
<td></td>
<td colspan="2" style="text-align:right">
<input type="button" value="<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_OKBUTTON'); ?>" onclick="okOption()" class="button">
<input type="button" value="<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ABORTBUTT'); ?>" onclick="quitOption()" class="button">
</td>
<td></td>
</tr>
</table>
</form>
</div>
<?php
} // if Select List
if ($row->type == 'Query List') {
?>
<div id="QueryColDialog" style="position:absolute;top:120px;left:30%;z-index:100;display:none;">
<form action="#" name='QueryColForm' onsubmit="return false;">
<table cellpadding="4" cellspacing="1" border="0" class="adminform" style="width:550px">
<tr><th colspan="4" class="title">BreezingForms - <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_EDITQUERYCOL'); ?></th></tr>
<tr>
<td></td>
<td>
<fieldset><legend><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_HEADER'); ?></legend>
<table class="adminform">
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TITLE'); ?>:</td>
<td nowrap>
<input type="text" size="50" maxlength="500" name="colTitle" class="inputbox"/>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_QCOLTIPTITLE'));
?>
</td>
</tr>
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <th>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="colClass1" class="inputbox"/>
</td>
</tr>
<tr>
<td nowrap><th> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SPAN'); ?>:</td>
<td nowrap>
<input type="text" size="6" maxlength="6" name="colThspan" class="inputbox"/>
</td>
</tr>
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ATTRIBUTES'); ?>:</td>
<td nowrap>
<select name="colThalign" size="1" class="inputbox">
<option value="0" selected="selected"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></option>
<option value="1"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LEFT'); ?></option>
<option value="2"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CENTER'); ?></option>
<option value="3"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RIGHT'); ?></option>
<option value="4"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_JUSTIFY'); ?></option>
</select>
<select name="colThvalign" size="1" class="inputbox">
<option value="0" selected="selected"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></option>
<option value="1"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TOP'); ?></option>
<option value="2"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MIDDLE'); ?></option>
<option value="3"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BOTTOM'); ?></option>
<option value="4"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BASELINE'); ?></option>
</select>
<select name="colThwrap" size="1" class="inputbox">
<option value="0" selected="selected"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></option>
<option value="1"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NOWRAP'); ?></option>
</select>
</td>
</tr>
</table>
</fieldset>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td>
<fieldset><legend><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_DATA'); ?></legend>
<table class="adminform">
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NAME'); ?>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="colName" class="inputbox"/>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_QCOLTIPNAME'));
?>
</td>
</tr>
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <td(1)>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="colClass2" class="inputbox"/>
</td>
</tr>
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <td(2)>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="colClass3" class="inputbox"/>
</td>
</tr>
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_WIDTH'); ?>:</td>
<td nowrap>
<input type="text" size="6" maxlength="6" name="colWidth" class="inputbox"/><select name="colWidthmd" size="1" class="inputbox">
<option value="0" selected="selected">px</option>
<option value="1">%</option>
</select>
</td>
</tr>
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ATTRIBUTES'); ?>:</td>
<td nowrap>
<select name="colAlign" size="1" class="inputbox">
<option value="0" selected="selected"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></option>
<option value="1"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LEFT'); ?></option>
<option value="2"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CENTER'); ?></option>
<option value="3"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RIGHT'); ?></option>
<option value="4"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_JUSTIFY'); ?></option>
</select>
<select name="colValign" size="1" class="inputbox">
<option value="0" selected="selected"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></option>
<option value="1"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TOP'); ?></option>
<option value="2"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MIDDLE'); ?></option>
<option value="3"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BOTTOM'); ?></option>
<option value="4"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BASELINE'); ?></option>
</select>
<select name="colWrap" size="1" class="inputbox">
<option value="0" selected="selected"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></option>
<option value="1"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NOWRAP'); ?></option>
</select>
</td>
</tr>
<tr>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_VALUE'); ?>:
<a href="#" onClick="document.QueryColForm.colValue.rows=<?php echo $ff_config->areasmall; ?>;">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="document.QueryColForm.colValue.rows=<?php echo $ff_config->areamedium; ?>;">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="document.QueryColForm.colValue.rows=<?php echo $ff_config->arealarge; ?>;">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="colValue" style="width:500px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"></textarea>
</td>
</tr>
</table>
</fieldset>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap colspan="2" style="text-align:right">
<input onclick="qcolOk();" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_TOOLBAR_SAVE'), ENT_QUOTES, 'UTF-8'); ?>"/>
<input onclick="qcolCancel();" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_TOOLBAR_CANCEL'), ENT_QUOTES, 'UTF-8'); ?>"/>
</td>
<td></td>
</tr>
</table>
</form>
</div>
<?php
} // if Query List
?>
<form action="index.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<table cellpadding="0" cellspacing="0" border="0" class="adminform" style="width:775px;">
<tr><th colspan="3" class="title">BreezingForms - <?php echo $action; ?> <?php echo HTML_facileFormsElement::displayType($row->type); ?></th></tr>
<tr>
<td></td>
<td width="100%">
<?php
$tabs = new BFTabs(0);
$tabs->startPane("editPane");
$tabs->startTab(BFText::_('COM_BREEZINGFORMS_ELEMENTS_SETTINGS'),"tab_settings");
?>
<table cellpadding="0" cellspacing="0" border="0" class="adminform">
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TITLE'); ?>:</td>
<td nowrap>
<input type="text" size="50" maxlength="50" name="title" value="<?php echo $row->title; ?>" class="inputbox"/>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_TIPTITLE'));
?>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NAME'); ?>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="name" value="<?php echo $row->name ?>" class="inputbox"/>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_TIPNAME'));
?>
</td>
<td></td>
</tr>
<?php
switch ($row->type) {
case 'Hidden Input':
break;
default:
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <div>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="class1" value="<?php echo $row->class1; ?>" class="inputbox"/>
</td>
<td></td>
</tr>
<?php
break;
} // switch
$elemname = '';
switch ($row->type) {
case 'Image':
case 'Tooltip':
case 'Icon': $elemname = 'img'; break;
case 'Checkbox':
case 'Radio Button':
case 'Regular Button':
case 'Text':
case 'File Upload': $elemname = 'input'; break;
case 'Graphic Button': $elemname = 'button'; break;
case 'Select List': $elemname = 'select'; break;
case 'Textarea': $elemname = 'textarea'; break;
case 'Query List': $elemname = 'table'; break;
default:;
} // switch
if ($elemname != '') {
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <<?php echo $elemname; ?>>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="class2" value="<?php echo $row->class2; ?>" class="inputbox"/>
</td>
<td></td>
</tr>
<?php
} // if
switch ($row->type) {
case 'Query List':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <tr(header)>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="trhclass" class="inputbox"/>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <tr(data1)>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="tr1class" class="inputbox"/>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <tr(data2)>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="tr2class" class="inputbox"/>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <tr(footer)>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="trfclass" class="inputbox"/>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_FORMS_CLASSFOR'); ?> <td(footer)>:</td>
<td nowrap>
<input type="text" size="30" maxlength="30" name="tdfclass" class="inputbox"/>
</td>
<td></td>
</tr>
<?php
default:;
} // switch
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ORDERING'); ?>:</td>
<td nowrap><?php echo $lists['ordering']; ?></td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PUBLISHED'); ?>:</td>
<td nowrap><?php echo JHTML::_('select.booleanlist', "published", "", $row->published); ?></td>
<td></td>
</tr>
<?php
switch ($row->type) {
case 'Checkbox':
case 'Radio Button':
case 'Select List':
case 'Query List':
case 'Text':
case 'File Upload':
case 'Textarea':
case 'Hidden Input':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_INCINLOG'); ?>:</td>
<td nowrap><?php echo JHTML::_('select.booleanlist', "logging", "", $row->logging); ?></td>
<td></td>
</tr>
<?php
break;
default:
break;
} // switch
switch ($row->type) {
case 'Hidden Input':
break;
default:
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_POSITION'); ?> X:</td>
<td nowrap>
<input size="6" maxlength="6" name="posx" value="<?php echo $row->posx; ?>" class="inputbox"/><select name="posxmode" size="1" class="inputbox">
<option value="0"<?php if ($row->posxmode==0) echo ' selected="selected"'; ?>>px</option>
<option value="1"<?php if ($row->posxmode==1) echo ' selected="selected"'; ?>>%</option>
</select>
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_POSITION'); ?> Y:
<input size="6" maxlength="6" name="posy" value="<?php echo $row->posy; ?>" class="inputbox"/><select name="posymode" size="1" class="inputbox">
<option value="0"<?php if ($row->posymode==0) echo ' selected="selected"'; ?>>px</option>
<option value="1"<?php if ($row->posymode==1) echo ' selected="selected"'; ?>>%</option>
</select>
</td>
<td></td>
</tr>
<?php
break;
} // switch
switch ($row->type) {
case 'Hidden Input':
break;
case 'Textarea':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_WIDTH'); ?>:</td>
<td nowrap>
<input size="6" maxlength="6" name="width" value="<?php echo $row->width; ?>" class="inputbox"/><select name="widthmode" size="1" class="inputbox">
<option value="0"<?php if ($row->widthmode==0) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_COLUMNS'); ?></option>
<option value="1"<?php if ($row->widthmode==1) echo ' selected="selected"'; ?>>px</option>
</select>
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_HEIGHT'); ?>:
<input size="6" maxlength="6" name="height" value="<?php echo $row->height; ?>" class="inputbox"/><select name="heightmode" size="1" class="inputbox">
<option value="0"<?php if ($row->heightmode==0) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ROWS'); ?></option>
<option value="1"<?php if ($row->heightmode==1) echo ' selected="selected"'; ?>>px</option>
</select>
</td>
<td></td>
</tr>
<?php
break;
case 'Captcha':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_WIDTH'); ?>:</td>
<td nowrap>
<input size="6" maxlength="6" name="width" value="<?php echo $row->width; ?>" class="inputbox"/> px
<input type="hidden" name="widthmode" value="1"/>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_HEIGHT'); ?>:</td>
<td nowrap>
<input size="6" maxlength="6" name="height" value="<?php echo $row->height; ?>" class="inputbox"/> px
</td>
<td></td>
</tr>
<?php
break;
case 'Text':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_WIDTH'); ?>:</td>
<td nowrap>
<input size="6" maxlength="6" name="width" value="<?php echo $row->width; ?>" class="inputbox"/><select name="widthmode" size="1" class="inputbox">
<option value="0"<?php if ($row->widthmode==0) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_COLUMNS'); ?></option>
<option value="1"<?php if ($row->widthmode==1) echo ' selected="selected"'; ?>>px</option>
</select>
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MAXLENGTH'); ?>:
<input size="6" maxlength="6" name="height" value="<?php echo $row->height; ?>" class="inputbox"/> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_COLUMNS'); ?>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MAILBACK'); ?>:</td>
<td nowrap>
<?php $yeschecked = ''; if ($row->mailback == 1) $yeschecked = 'checked="checked"'; ?>
<?php $nochecked = ''; if ($row->mailback == 0) $nochecked = 'checked="checked"'; ?>
<?php echo BFText::_('COM_BREEZINGFORMS_NO'); ?> <input type="radio" name="mailback" value="0" <?php echo $nochecked ?>/>
<?php echo BFText::_('COM_BREEZINGFORMS_YES'); ?> <input type="radio" name="mailback" value="1" <?php echo $yeschecked ?>/>
</td>
<td></td>
</tr>
<?php
break;
case 'Select List':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_WIDTH'); ?>:</td>
<td nowrap>
<input size="6" maxlength="6" name="width" value="<?php echo $row->width; ?>" class="inputbox"/> px
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_HEIGHT'); ?>:
<input size="6" maxlength="6" name="height" value="<?php echo $row->height; ?>" class="inputbox"/> px
</td>
<td></td>
</tr>
<?php
break;
case 'File Upload':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_FIELDSZ'); ?>:</td>
<td nowrap>
<input size="6" maxlength="6" name="width" value="<?php echo $row->width; ?>" class="inputbox"/>
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MAXFILESIZE'); ?>:
<input size="8" maxlength="8" name="height" value="<?php echo $row->height; ?>" class="inputbox"/>
</td>
<td></td>
</tr>
<?php
break;
case 'Static Text/HTML':
case 'Rectangle':
case 'Image':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_WIDTH'); ?>:</td>
<td nowrap>
<input size="6" maxlength="6" name="width" value="<?php echo $row->width; ?>" class="inputbox"/><select name="widthmode" size="1" class="inputbox">
<option value="0"<?php if ($row->widthmode==0) echo ' selected="selected"'; ?>>px</option>
<option value="1"<?php if ($row->widthmode==1) echo ' selected="selected"'; ?>>%</option>
</select>
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_HEIGHT'); ?>:
<input size="6" maxlength="6" name="height" value="<?php echo $row->height; ?>" class="inputbox"/><select name="heightmode" size="1" class="inputbox">
<option value="0"<?php if ($row->heightmode==0) echo ' selected="selected"'; ?>>px</option>
<option value="1"<?php if ($row->heightmode==1) echo ' selected="selected"'; ?>>%</option>
</select>
<?php
if ($row->type=='Image')
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_IMAGE0'));
else
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_OTHER0'));
?>
</td>
<td></td>
</tr>
<?php
break;
case 'Query List':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_WIDTH'); ?>:</td>
<td nowrap>
<input size="6" maxlength="6" name="width" value="<?php echo $row->width; ?>" class="inputbox"/><select name="widthmode" size="1" class="inputbox">
<option value="0"<?php if ($row->widthmode==0) echo ' selected="selected"'; ?>>px</option>
<option value="1"<?php if ($row->widthmode==1) echo ' selected="selected"'; ?>>%</option>
</select>
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ROWSPERPAGE'); ?>:
<input size="6" maxlength="6" name="height" value="<?php echo $row->height; ?>" class="inputbox" onchange="showpagenav(this.value)"/>
</td>
<td></td>
</tr>
<tr id="pagenavrow"<?php if ($row->height==0) echo ' style="display:none"'; ?>>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PAGENAV'); ?>:</td>
<td nowrap>
<select name="pagenav" size="1" class="inputbox">
<option value="0">none</option>
<option value="1" selected="selected"><< <?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGESTART'); ?> < <?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEPREV'); ?> 1 2 3 <?php BFText::_('COM_BREEZINGFORMS_PROCESS_PAGENEXT'); ?> > <?php BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEEND'); ?> >></option>
<option value="2"><< <?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGESTART'); ?> < <?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEPREV'); ?> <?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGENEXT'); ?> > <?php echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEEND'); ?> >></option>
<option value="3"><< < 1 2 3 > >></option>
<option value="4"><< < > >></option>
<option value="5">1 2 3</option>
</select>
</td>
<td></td>
</tr>
<?php
break;
default:
break;
} // switch
switch ($row->type) {
case 'Checkbox':
case 'Radio Button':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CHECKED'); ?>:</td>
<td nowrap><?php echo JHTML::_('select.booleanlist', "flag1", "", $row->flag1); ?></td>
<td></td>
</tr>
<?php
break;
case 'Select List':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MULTIPLE'); ?>:</td>
<td nowrap><?php echo JHTML::_('select.booleanlist', "flag1", "", $row->flag1); ?></td>
<td></td>
</tr>
<?php
break;
case 'Query List':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SHOWHEADER'); ?>:</td>
<td nowrap><?php echo JHTML::_('select.booleanlist', "flag1", "", $row->flag1); ?></td>
<td></td>
</tr>
<?php
break;
case 'Text':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PASSWORD'); ?>:</td>
<td nowrap><?php echo JHTML::_('select.booleanlist', "flag1", "", $row->flag1); ?></td>
<td></td>
</tr>
<?php
break;
case 'File Upload':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_UPLDTIMESTAMP'); ?>:</td>
<td nowrap><?php echo JHTML::_('select.booleanlist', "flag1", "", $row->flag1); ?></td>
<td></td>
</tr>
<?php
break;
case 'Tooltip':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE'); ?>:</td>
<td nowrap>
<input type="radio" id="flag10" name="flag1" value="0"<?php if ($row->flag1==0) echo ' checked="checked"'; ?> onclick="disptooltipurl(this.value)"/><label for="flag10"> <img src="<?php echo $ff_mossite; ?>components/com_breezingforms/images/js/ThemeOffice/tooltip.png" alt="" border="0"/></label>
<input type="radio" id="flag11" name="flag1" value="1"<?php if ($row->flag1==1) echo ' checked="checked"'; ?> onclick="disptooltipurl(this.value)"/><label for="flag11"> <img src="<?php echo $ff_mossite; ?>components/com_breezingforms/images/js/ThemeOffice/warning.png" alt="" border="0"/></label>
<input type="radio" id="flag12" name="flag1" value="2"<?php if ($row->flag1==2) echo ' checked="checked"'; ?> onclick="disptooltipurl(this.value)"/><label for="flag12"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CUSTOM'); ?></label>
<td></td>
</tr>
<?php
default:
break;
} // switch
switch ($row->type) {
case 'Checkbox':
case 'Radio Button':
case 'Regular Button':
case 'Graphic Button':
case 'Select List':
case 'File Upload':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE'); ?>:</td>
<td nowrap>
<select name="flag2" size="1" class="inputbox">
<option value="0"<?php if ($row->flag2==0) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ENABLED'); ?></option>
<option value="1"<?php if ($row->flag2==1) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_DISABLED'); ?></option>
</select>
<td></td>
</tr>
<?php
break;
case 'Icon':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BORDER'); ?>:</td>
<td nowrap><?php echo JHTML::_('select.booleanlist', "flag2", "", $row->flag2); ?></td>
<td></td>
</tr>
<?php
break;
case 'Text':
case 'Textarea':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE'); ?>:</td>
<td nowrap>
<select name="flag2" size="1" class="inputbox">
<option value="0"<?php if ($row->flag2==0) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ENABLED'); ?></option>
<option value="1"<?php if ($row->flag2==1) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_DISABLED'); ?></option>
<option value="2"<?php if ($row->flag2==2) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_READONLY'); ?></option>
</select>
<td></td>
</tr>
<?php
break;
case 'Query List':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_FIRSTCOLUMN'); ?>:</td>
<td nowrap>
<select name="flag2" size="1" class="inputbox">
<option value="0"<?php if ($row->flag2==0) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NORMAL'); ?></option>
<option value="1"<?php if ($row->flag2==1) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CHECKBOXES'); ?></option>
<option value="2"<?php if ($row->flag2==2) echo ' selected="selected"'; ?>><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RADIOBUTTONS'); ?></option>
</select>
</td>
<td></td>
</tr>
<?php
break;
default:
break;
} // switch
switch ($row->type) {
case 'File Upload':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_UPLDIR'); ?>:
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data1" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data1, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Static Text/HTML':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TEXTHTML'); ?>:
<?php
if ($ff_config->wysiwyg) {
echo '<br/>';
jimport( 'joomla.html.editor' );
$editor = JFactory::getEditor();
echo $editor->display('data1', $row->data1, 'data1', '500', '100%', '45', '10');
} else {
echo '<a href="#" onClick="textAreaResize(\'data1\','.$ff_config->areasmall.');">['.$ff_config->areasmall.']</a> '.
'<a href="#" onClick="textAreaResize(\'data1\','.$ff_config->areamedium.');">['.$ff_config->areamedium.']</a> '.
'<a href="#" onClick="textAreaResize(\'data1\','.$ff_config->arealarge.');">['.$ff_config->arealarge.']</a>'.
'<br/>'.
'<textarea wrap="off" name="data1" style="width:700px;" rows="'.$ff_config->areasmall.'" class="inputbox">'.htmlspecialchars($row->data1, ENT_QUOTES).'</textarea>';
} // if
?>
</td>
<td></td>
</tr>
<?php
break;
case 'Textarea':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_VALUE'); ?>:
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data1" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data1, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Hidden Input':
case 'Checkbox':
case 'Radio Button':
case 'Text':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_VALUE'); ?>:
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data1" style="width:700px" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data1, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Rectangle':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BORDER'); ?>:
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data1" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data1, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Image':
case 'Graphic Button':
case 'Icon':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_IMGURL'); ?>:
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data1" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data1, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Tooltip':
?>
<tr id="tooltipurl" style="display:none;">
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_IMGURL'); ?>:
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data1" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data1, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Select List':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SIZE'); ?>:
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data1',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data1" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data1, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Query List':
?>
<tr>
<td></td>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BORDERWIDTH'); ?>:</td>
<td nowrap>
<input size="3" maxlength="2" name="border" class="inputbox"/>
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CELLSPACING'); ?>:
<input size="3" maxlength="2" name="cellspacing" class="inputbox"/>
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CELLPADDING'); ?>:
<input size="3" maxlength="2" name="cellpadding" class="inputbox"/>
</td>
<td></td>
</tr>
<?php
break;
default:
break;
} // switch
switch ($row->type) {
case 'Icon':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_IMGURLF2'); ?>:
<a href="#" onClick="textAreaResize('data3',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data3',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data3',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data3" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data3, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
default:
break;
} // switch
switch ($row->type) {
case 'File Upload':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MIMETYPES'); ?>:
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data2" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Graphic Button':
case 'Icon':
?>
<tr>
<td></td>
<td colspan="2">
<fieldset><legend><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CAPTION'); ?></legend>
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE'); ?>:</td>
<td nowrap>
<input type="radio" id="flag10" name="flag1" value="0"<?php if ($row->flag1==0) echo ' checked="checked"'; ?> onclick="dispcaptiontext(this.value)"/><label for="flag10"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></label>
<input type="radio" id="flag11" name="flag1" value="1"<?php if ($row->flag1==1) echo ' checked="checked"'; ?> onclick="dispcaptiontext(this.value)"/><label for="flag11"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BELOW'); ?></label>
<input type="radio" id="flag12" name="flag1" value="2"<?php if ($row->flag1==2) echo ' checked="checked"'; ?> onclick="dispcaptiontext(this.value)"/><label for="flag12"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ABOVE'); ?></label>
<input type="radio" id="flag13" name="flag1" value="3"<?php if ($row->flag1==3) echo ' checked="checked"'; ?> onclick="dispcaptiontext(this.value)"/><label for="flag13"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LEFT'); ?></label>
<input type="radio" id="flag14" name="flag1" value="4"<?php if ($row->flag1==4) echo ' checked="checked"'; ?> onclick="dispcaptiontext(this.value)"/><label for="flag14"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RIGHT'); ?></label>
</td>
</tr>
<tr id="captiontext" style="display:none;">
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TEXT'); ?>:
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data2" style="width:680px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
</td>
</tr>
</table>
</fieldset>
</td>
<td></td>
</tr>
<?php
break;
case 'Tooltip':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TEXT'); ?>:
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data2" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Radio Button':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CAPTION'); ?>:
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data2" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Checkbox':
case 'Regular Button':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LABEL'); ?>:
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data2" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Rectangle':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BKGCOLOR'); ?>:
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data2" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Image':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ALTTEXT'); ?>:
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<br/>
<textarea wrap="off" name="data2" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
<?php
break;
case 'Select List':
?>
<tr>
<td></td>
<td nowrap colspan="2">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_OPTIONS'); ?>:
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="textAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<a href="#" onClick="addOption();"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ADDOPTIONS'); ?></a>
<br/>
<textarea wrap="off" name="data2" style="width:700px;" rows="<?php echo $ff_config->areasmall; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_OPTINFO'));
?>
</td>
<td></td>
</tr>
<?php
break;
default:
break;
} // switch
?>
</table>
<?php
if ($row->type == 'Query List') {
$tabs->endTab();
$tabs->startTab(BFText::_('COM_BREEZINGFORMS_ELEMENTS_QUERY'),"tab_query");
?>
<table class="adminform">
<tr>
<td></td>
<td nowrap colspan="2">
<a href="#" onClick="codeAreaResize('data2',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="codeAreaResize('data2',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="codeAreaResize('data2',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<a href="#" onClick="createQueryCode();"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CREATEQUERY'); ?></a>
<?php echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_TIPQUERY')); ?>
<br />
<textarea onFocus="codeAreaFocus(this);" readonly="readonly" wrap="off" name="data2lines" style="width:60px;" rows="<?php echo $ff_config->areamedium; ?>" class="inputbox"></textarea>
<textarea onFocus="codeAreaFocus(this);" onKeyUp="codeAreaChange(this,event);" wrap="off" name="data2" style="width:630px;" rows="<?php echo $ff_config->areamedium; ?>" class="inputbox"><?php echo htmlspecialchars($row->data2, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
</table>
<?php
$tabs->endTab();
$tabs->startTab(BFText::_('COM_BREEZINGFORMS_ELEMENTS_QUERYCOLS'),"tab_querycols");
?>
<table width="100%" class="adminform">
<tr>
<td></td>
<td nowrap colspan="2">
<div style="text-align:right;">
<input type="button" value="<?php echo BFText::_('COM_BREEZINGFORMS_TOOLBAR_NEW'); ?>" onclick="qcolAdd()" class="button"/>
<input type="button" value="<?php echo BFText::_('COM_BREEZINGFORMS_TOOLBAR_COPY'); ?>" onclick="qcolCopy()" class="button"/>
<input type="button" value="<?php echo BFText::_('COM_BREEZINGFORMS_TOOLBAR_DELETE'); ?>" onclick="qcolDelete()" class="button"/>
</div><br/>
<table id="qcolTable" width="100%" class="adminlist">
<tr>
<th nowrap valign="top" align="center"><input id="qcolCbAll" name="qcolCbAll" type="checkbox" value="1" onclick="qcolCheckAll(this.checked);" /></th>
<th width="100%" valign="top" align="left"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TITLE'); ?></th>
<th nowrap valign="top" align="left"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NAME'); ?></th>
<th nowrap valign="top" align="left"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_HEADER').' '.BFText::_('COM_BREEZINGFORMS_ELEMENTS_ATTRIBUTES'); ?></th>
<th nowrap valign="top" align="left"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_DATA').' '.BFText::_('COM_BREEZINGFORMS_ELEMENTS_ATTRIBUTES'); ?></th>
<th nowrap valign="top" align="left"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_WIDTH'); ?></th>
<th nowrap valign="top" align="center" colspan="2"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_REORDER'); ?></th>
</tr>
</table>
</td>
<td></td>
</tr>
</table>
<?php
} // if
if ($hasInit || $hasAction || $hasValidation) {
$tabs->endTab();
$tabs->startTab(BFText::_('COM_BREEZINGFORMS_ELEMENTS_SCRIPTS'),"tab_scripts");
?>
<table class="adminform">
<?php
if ($hasInit) {
?>
<tr>
<td></td>
<td colspan="2">
<fieldset><legend><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_INITSCRIPT'); ?></legend>
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE'); ?>:</td>
<td nowrap>
<input type="radio" id="script1cond1" name="script1cond" value="0" onclick="dispinit(this.value)"<?php if ($row->script1cond==0) echo ' checked="checked"'; ?> /><label for="script1cond1"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></label>
<input type="radio" id="script1cond2" name="script1cond" value="1" onclick="dispinit(this.value)"<?php if ($row->script1cond==1) echo ' checked="checked"'; ?> /><label for="script1cond2"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LIBRARY'); ?></label>
<input type="radio" id="script1cond3" name="script1cond" value="2" onclick="dispinit(this.value)"<?php if ($row->script1cond==2) echo ' checked="checked"'; ?> /><label for="script1cond3"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CUSTOM'); ?></label>
</td>
<td></td>
</tr>
<tr id="initexec" style="display:none;">
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CONDITIONS'); ?>:</td>
<td nowrap>
<input type="checkbox" id="script1flag1" name="script1flag1" value="1"<?php if ($row->script1flag1==1) echo ' checked="checked"'; ?> /><label for="script1flag1"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_FORMENTRY'); ?></label>
<input type="checkbox" id="script1flag2" name="script1flag2" value="1"<?php if ($row->script1flag2==1) echo ' checked="checked"'; ?> /><label for="script1flag2"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PAGEENTRY'); ?></label>
</td>
<td></td>
</tr>
<tr id="initlib" style="display:none;">
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SCRIPT'); ?>:</td>
<td nowrap>
<select name="script1id" size="1" class="inputbox">
<?php
$scripts = $lists['scripts1'];
for ($i = 0; $i < count($scripts); $i++) {
$script = $scripts[$i];
$selected = '';
if ($script->id == $row->script1id) $selected = ' selected';
echo '<option value="'.$script->id.'"'.$selected.'>'.$script->text.'</option>';
} // for
?>
</select>
</td>
<td></td>
</tr>
<tr id="initcode" style="display:none;">
<td nowrap valign="top" colspan="2">
<a href="#" onClick="codeAreaResize('script1code',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="codeAreaResize('script1code',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="codeAreaResize('script1code',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<a href="#" onClick="createInitCode();"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CREATECODE'); ?></a>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_TIPINIT'))."\n";
?>
<br />
<textarea onFocus="codeAreaFocus(this);" readonly="readonly" wrap="off" name="script1lines" style="width:60px;" rows="<?php echo $s1size; ?>" class="inputbox"></textarea>
<textarea onFocus="codeAreaFocus(this);" onKeyUp="codeAreaChange(this,event);" wrap="off" name="script1code" style="width:610px;" rows="<?php echo $s1size; ?>" class="inputbox"><?php echo htmlspecialchars($row->script1code, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
</table>
</fieldset>
</td>
<td></td>
</tr>
<?php
} // if hasInit
if ($hasAction) {
?>
<tr>
<td></td>
<td colspan="2">
<fieldset><legend><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ACTIONSCRIPT'); ?></legend>
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE'); ?>:</td>
<td nowrap>
<input type="radio" id="script2cond1" name="script2cond" value="0" onclick="dispaction(this.value)"<?php if ($row->script2cond==0) echo ' checked="checked"'; ?> /><label for="script2cond1"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></label>
<input type="radio" id="script2cond2" name="script2cond" value="1" onclick="dispaction(this.value)"<?php if ($row->script2cond==1) echo ' checked="checked"'; ?> /><label for="script2cond2"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LIBRARY'); ?></label>
<input type="radio" id="script2cond3" name="script2cond" value="2" onclick="dispaction(this.value)"<?php if ($row->script2cond==2) echo ' checked="checked"'; ?> /><label for="script2cond3"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CUSTOM'); ?></label>
</td>
<td></td>
</tr>
<tr id="actionact" style="display:none;">
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ACTIONS'); ?>:</td>
<td nowrap>
<?php
switch ($row->type) {
case 'Regular Button':
case 'Graphic Button':
case 'Icon':
?>
<input type="checkbox" id="script2flag1" name="script2flag1" value="1"<?php if ($row->script2flag1==1) echo ' checked="checked"'; ?>/><label for="script2flag1"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CLICK'); ?></label>
<?php
break;
default:
?>
<input type="checkbox" id="script2flag1" name="script2flag1" value="1"<?php if ($row->script2flag1==1) echo ' checked="checked"'; ?>/><label for="script2flag1"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CLICK'); ?></label>
<input type="checkbox" id="script2flag2" name="script2flag2" value="1"<?php if ($row->script2flag2==1) echo ' checked="checked"'; ?>/><label for="script2flag2"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BLUR'); ?></label>
<input type="checkbox" id="script2flag3" name="script2flag3" value="1"<?php if ($row->script2flag3==1) echo ' checked="checked"'; ?>/><label for="script2flag3"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CHANGE'); ?></label>
<input type="checkbox" id="script2flag4" name="script2flag4" value="1"<?php if ($row->script2flag4==1) echo ' checked="checked"'; ?>/><label for="script2flag4"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_FOCUS'); ?></label>
<input type="checkbox" id="script2flag5" name="script2flag5" value="1"<?php if ($row->script2flag5==1) echo ' checked="checked"'; ?>/><label for="script2flag5"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELECTION'); ?></label>
<?php
break;
} // switch
?>
</td>
<td></td>
</tr>
<tr id="actionlib" style="display:none;">
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SCRIPT'); ?>:</td>
<td nowrap>
<select name="script2id" size="1" class="inputbox">
<?php
$scripts = $lists['scripts2'];
for ($i = 0; $i < count($scripts); $i++) {
$script = $scripts[$i];
$selected = '';
if ($script->id == $row->script2id) $selected = ' selected';
echo '<option value="'.$script->id.'"'.$selected.'>'.$script->text.'</option>';
} // for
?>
</select>
</td>
<td></td>
</tr>
<tr id="actioncode" style="display:none;">
<td nowrap valign="top" colspan="2">
<a href="#" onClick="codeAreaResize('script2code',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="codeAreaResize('script2code',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="codeAreaResize('script2code',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<a href="#" onClick="createActionCode();"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CREATECODE'); ?></a>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_TIPACTION'))."\n";
?>
<br />
<textarea onFocus="codeAreaFocus(this);" readonly="readonly" wrap="off" name="script2lines" style="width:60px;" rows="<?php echo $s2size; ?>" class="inputbox"></textarea>
<textarea onFocus="codeAreaFocus(this);" onKeyUp="codeAreaChange(this,event);" wrap="off" name="script2code" style="width:610px;" rows="<?php echo $s2size; ?>" class="inputbox"><?php echo htmlspecialchars($row->script2code, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
</table>
</fieldset>
</td>
<td></td>
</tr>
<?php
} // if hasAction
if ($hasValidation) {
?>
<tr>
<td></td>
<td colspan="2">
<fieldset><legend><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_VALIDSCRIPT'); ?></legend>
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE'); ?>:</td>
<td nowrap>
<input type="radio" id="script3cond1" name="script3cond" value="0" onclick="dispvalidation(this.value)"<?php if ($row->script3cond==0) echo ' checked="checked"'; ?> /><label for="script3cond1"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NONE'); ?></label>
<input type="radio" id="script3cond2" name="script3cond" value="1" onclick="dispvalidation(this.value)"<?php if ($row->script3cond==1) echo ' checked="checked"'; ?> /><label for="script3cond2"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_LIBRARY'); ?></label>
<input type="radio" id="script3cond3" name="script3cond" value="2" onclick="dispvalidation(this.value)"<?php if ($row->script3cond==2) echo ' checked="checked"'; ?> /><label for="script3cond3"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CUSTOM'); ?></label>
</td>
<td></td>
</tr>
<tr id="validationmsg" style="display:none;">
<td nowrap valign="top"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MESSAGE'); ?>:</td>
<td nowrap valign="top">
<input type="text" size="50" maxlength="255" name="script3msg" value="<?php echo $row->script3msg; ?>" class="inputbox"/>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_TIPMESSAGE'))."\n";
?>
</td>
<td></td>
</tr>
<tr id="validationlib" style="display:none;">
<td nowrap><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SCRIPT'); ?>:</td>
<td nowrap>
<select name="script3id" size="1" class="inputbox">
<?php
$scripts = $lists['scripts3'];
for ($i = 0; $i < count($scripts); $i++) {
$script = $scripts[$i];
$selected = '';
if ($script->id == $row->script3id) $selected = ' selected';
echo '<option value="'.$script->id.'"'.$selected.'>'.$script->text.'</option>';
} // for
?>
</select>
</td>
<td></td>
</tr>
<tr id="validationcode" style="display:none;">
<td nowrap valign="top" colspan="2">
<a href="#" onClick="codeAreaResize('script3code',<?php echo $ff_config->areasmall; ?>);">[<?php echo $ff_config->areasmall; ?>]</a>
<a href="#" onClick="codeAreaResize('script3code',<?php echo $ff_config->areamedium; ?>);">[<?php echo $ff_config->areamedium; ?>]</a>
<a href="#" onClick="codeAreaResize('script3code',<?php echo $ff_config->arealarge; ?>);">[<?php echo $ff_config->arealarge; ?>]</a>
<a href="#" onClick="createValidationCode();"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_CREATECODE'); ?></a>
<?php
echo bf_ToolTip(BFText::_('COM_BREEZINGFORMS_ELEMENTS_TIPVALID'))."\n";
?>
<br />
<textarea onFocus="codeAreaFocus(this);" readonly="readonly" wrap="off" name="script3lines" style="width:60px;" rows="<?php echo $s3size; ?>" class="inputbox"></textarea>
<textarea onFocus="codeAreaFocus(this);" onKeyUp="codeAreaChange(this,event);" wrap="off" name="script3code" style="width:610px;" rows="<?php echo $s3size; ?>" class="inputbox"><?php echo htmlspecialchars($row->script3code, ENT_QUOTES); ?></textarea>
</td>
<td></td>
</tr>
</table>
</fieldset>
</td>
<td></td>
</tr>
<?php
} // if hasValidation
?>
</table>
<?php
} // if hasInit, hasAction or hasValidation
$tabs->endTab();
$tabs->endPane();
?>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap style="text-align:right">
<input type="submit" onclick="<?php if ($row->type=='Query List') echo "\t\t\t\tsaveQueryList();" ?>document.getElementById('task').value='save';" value="<?php echo BFText::_('COM_BREEZINGFORMS_TOOLBAR_SAVE'); ?>"/>
<input type="submit" onclick="document.getElementById('task').value='cancel';" value="<?php echo BFText::_('COM_BREEZINGFORMS_TOOLBAR_CANCEL'); ?>"/>
</td>
<td></td>
</tr>
</table>
<?php
if ($row->type == 'Query List') {
?>
<input type="hidden" name="data1" value="<?php echo htmlspecialchars($row->data1, ENT_QUOTES); ?>"/>
<input type="hidden" name="data3" value="<?php echo htmlspecialchars($row->data3, ENT_QUOTES); ?>"/>
<?php
} // if
?>
<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
<input type="hidden" name="pkg" value="<?php echo $pkg; ?>" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" id="task" name="task" value="" />
<input type="hidden" name="act" value="editpage" />
<input type="hidden" name="form" value="<?php echo $row->form; ?>" />
<input type="hidden" name="page" value="<?php echo $row->page; ?>" />
<input type="hidden" name="type" value="<?php echo $row->type; ?>" />
</form>
<?php
} // edit
function listitems($option, $pkg, &$form, $page, &$rows, $prevmode, &$checkedIds)
{
global $ff_processor, $ff_mospath, $ff_mossite, $ff_admicon, $ff_comsite, $ff_config,
$ff_request, $ff_version, $database, $my;
$mainframe = JFactory::getApplication();
$database = JFactory::getDBO();
$ff_mossite = JURI::root();
?>
<script type="text/javascript">
<!--
var bf_submitbutton = function(pressbutton)
{
var form = document.adminForm;
switch (pressbutton) {
case 'close':
location.href="index.php?option=com_breezingforms&act=manageforms";
return;
break;
case 'copy':
case 'move':
case 'publish':
case 'unpublish':
case 'remove':
if (form.boxchecked.value==0) {
alert("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELELEMENTS'); ?>");
return;
} // if
break;
default:
break;
} // switch
switch (pressbutton) {
case 'share':
form.act.value = 'share';
break;
case 'sort':
if (!confirm("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ASKSORT'); ?>")) return;
break;
case 'remove':
if (!confirm("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ASKDELELEMENTS'); ?>")) return;
break;
case 'delpage':
if (!confirm("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ASKDELPAGE'); ?>")) return;
break;
case 'movepos':
if (form.movepixels.value=='') {
alert("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ENTPIXMOVE'); ?>");
return;
} // if
var nonDigits = /\D/;
if (nonDigits.test(form.movepixels.value)) {
alert("<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PIXMOVEINT'); ?>");
return;
} // if
break;
default:
break;
} // switch
submitform(pressbutton);
}; // submitbutton
if(typeof Joomla != "undefined"){
Joomla.submitbutton = bf_submitbutton;
}
submitbutton = bf_submitbutton;
function changepage(newpage)
{
document.adminForm.page.value = newpage;
submitform('');
} // changepage
function listItemTask( id, task )
{
var f = document.adminForm;
cb = eval( 'f.' + id );
if (cb) {
for (i = 0; true; i++) {
cbx = eval('f.cb'+i);
if (!cbx) break;
cbx.checked = false;
} // for
cb.checked = true;
f.boxchecked.value = 1;
submitbutton(task);
}
return false;
} // listItemTask
<?php if ($form->prevmode > 0) { ?>
ff_coords = [
<?php
for($i = 0; $i < count($rows); $i++) {
$row = $rows[$i];
if ($i) echo ",\n";
echo
"\t\t\t\t["
.intval(isVisibleElement($row->type)).','
.intval($row->posx).','.intval($row->posx).','.intval($row->posxmode).','
.intval($row->posy).','.intval($row->posy).','.intval($row->posymode).']';
} // for
if ($i) echo "\n"; else echo "\t\t\t\t0";
?>
];
var highlightTmpColor = "";
var highlightTmpPadding = "";
function highlightElement( elementIndex ){
var f = document.adminForm;
<?php if ($ff_config->stylesheet) { ?>
var fd = ff_prevframe.document;
<?php } else { ?>
var fd = document;
<?php } // endif ?>
var cb = eval('f.cb'+elementIndex);
highlightTmpColor = fd.getElementById('ff_div'+cb.value).style.backgroundColor;
highlightTmpPadding = fd.getElementById('ff_div'+cb.value).style.padding;
fd.getElementById('ff_div'+cb.value).style.backgroundColor = "red";
fd.getElementById('ff_div'+cb.value).style.padding = "5px";
}
function unhighlightElement( elementIndex ){
var f = document.adminForm;
<?php if ($ff_config->stylesheet) { ?>
var fd = ff_prevframe.document;
<?php } else { ?>
var fd = document;
<?php } // endif ?>
var cb = eval('f.cb'+elementIndex);
fd.getElementById('ff_div'+cb.value).style.backgroundColor = highlightTmpColor;
fd.getElementById('ff_div'+cb.value).style.padding = highlightTmpPadding;
}
function moveElements(direction)
{
var f = document.adminForm;
var step = parseInt(f.id_movepixels.value);
if (step==0) return;
<?php if ($ff_config->stylesheet) { ?>
var fd = ff_prevframe.document;
<?php } else { ?>
var fd = document;
<?php } // endif ?>
var i;
for (i = 0; i < <?php echo count($rows); ?>; i++) {
var cb = eval('f.cb'+i);
if (cb.checked && ff_coords[i][0]) {
var el = fd.getElementById('ff_div'+cb.value).style;
var x,y,u;
switch (direction) {
case 'left':
x = ff_coords[i][2];
if (ff_coords[i][3]) u = '%'; else u = 'px';
if (x >= 0) {
if (x > step)
x -= step;
else
x = 0;
el.left = x+u;
} else {
x -= step;
el.right = (-x)+u;
} // if
ff_coords[i][2] = x;
break;
case 'right':
x = ff_coords[i][2];
if (ff_coords[i][3]) u = '%'; else u = 'px';
if (x >= 0) {
x += step;
el.left = x+u;
} else {
if ((-x) > step)
x += step;
else
x = -1;
el.right = (-y)+u;
} // if
ff_coords[i][2] = x;
break;
case 'up':
y = ff_coords[i][5];
if (ff_coords[i][6]) u = '%'; else u = 'px';
if (y >= 0) {
if (y > step)
y -= step;
else
y = 0;
el.top = y+u;
} else {
y -= step;
el.bottom = (-y)+u;
} // if
ff_coords[i][5] = y;
break;
case 'down':
y = ff_coords[i][5];
if (ff_coords[i][6]) u = '%'; else u = 'px';
if (y >= 0) {
y += step;
el.top = y+u;
} else {
if ((-y) > step)
y += step;
else
y = -1;
el.bottom = (-y)+u;
} // if
ff_coords[i][5] = y;
break;
default:;
} // switch
} // if
} // for
var disabled = true;
for (i = 0; i < <?php echo count($rows); ?>; i++)
if (ff_coords[i][1]!=ff_coords[i][2] || ff_coords[i][4]!=ff_coords[i][5]) {
disabled = false;
break;
} // if
f.savepos.disabled = disabled;
f.restpos.disabled = disabled;
} // moveElements
function savePositions()
{
var f = document.adminForm;
<?php if ($ff_config->stylesheet) { ?>
var fd = ff_prevframe.document;
<?php } else { ?>
var fd = document;
<?php } // endif ?>
var i;
var pos = '';
for (i = 0; i < <?php echo count($rows); ?>; i++)
if (ff_coords[i][1]!=ff_coords[i][2] || ff_coords[i][4]!=ff_coords[i][5]) {
var cb = eval('f.cb'+i);
var el = fd.getElementById('ff_div'+cb.value).style;
if (pos != '') pos += ',';
pos += cb.value+','+ff_coords[i][2]+','+ff_coords[i][5];
} // if
f.movepositions.value = pos;
submitbutton('movepos');
} // savePositions
function restorePositions()
{
var f = document.adminForm;
<?php if ($ff_config->stylesheet) { ?>
var fd = ff_prevframe.document;
<?php } else { ?>
var fd = document;
<?php } // endif ?>
var i;
for (i = 0; i < <?php echo count($rows); ?>; i++)
if (ff_coords[i][1]!=ff_coords[i][2] || ff_coords[i][4]!=ff_coords[i][5]) {
var cb = eval('f.cb'+i);
var el = fd.getElementById('ff_div'+cb.value).style;
var x = ff_coords[i][2] = ff_coords[i][1];
var y = ff_coords[i][5] = ff_coords[i][4];
var u;
if (ff_coords[i][3]) u = '%'; else u = 'px';
if (x >= 0) el.left = x+u; else el.right = (-x)+u;
if (ff_coords[i][6]) u = '%'; else u = 'px';
if (y >= 0) el.top = y+u; else el.bottom = (-y)+u;
} // if
f.savepos.disabled = true;
f.restpos.disabled = true;
} // restorePositions
<?php } // endif ?>
<?php if ($prevmode=='submit') { ?>
onload = function()
{
submitform('');
} // onload
<?php } // endif ?>
//-->
</script>
<div id="overDiv" style="position:absolute;visibility:hidden;z-index:1000;"></div>
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td nowrap>
<table class="adminheading">
<tr><th class="edit" nowrap>BreezingForms <?php echo $ff_version; ?><br/><span class="componentheading"><?php echo $form->title; ?> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PAGE'); ?> <?php echo $page; ?></span></th></tr>
</table>
</td>
<td width="100%" align="right" nowrap>
<?php
JToolBarHelper::custom('editform', 'edit.png', 'edit_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_EDITFORM'), false);
JToolBarHelper::custom('new', 'new.png', 'new_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_NEW'), false);
JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_COPY'), false);
JToolBarHelper::custom('move', 'move.png', 'move_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_MOVE'), false);
JToolBarHelper::custom('publish', 'publish.png', 'publish_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_PUBLISH'), false);
JToolBarHelper::custom('unpublish', 'unpublish.png', 'unpublish_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_UNPUBLISH'), false);
JToolBarHelper::custom('remove', 'delete.png', 'delete_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_DELETE'), false);
JToolBarHelper::custom('close', 'cancel.png', 'cancel_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_QUICKMODE_CLOSE'), false);
?>
</td>
</tr>
</table>
<form action="index.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
<tr>
<th nowrap align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" /></th>
<th nowrap align="left"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TITLE'); ?></th>
<th nowrap align="left"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NAME'); ?></th>
<th nowrap align="left"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE'); ?></th>
<th nowrap align="center"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PUBLISHED'); ?></th>
<th nowrap align="center" colspan="2"><a href="#sort" onclick="submitbutton('sort')"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_REORDER'); ?></a></th>
<th nowrap align="center">X</th>
<th nowrap align="center">Y</th>
<th nowrap align="center"><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SCRIPTID'); ?></th>
<th width="100%"></th>
</tr>
<?php
$k = 0;
$boxchecked = 0;
for($i = 0; $i < count( $rows ); $i++) {
$row = $rows[$i];
$checked = '';
if (in_array($row->id, $checkedIds)) {
$checked = 'checked="checked"';
$boxchecked++;
} // if
?>
<tr class="row<?php echo $k ?>">
<td nowrap align="center"><input type="checkbox" id="cb<?php echo $i; ?>" name="ids[]" value="<?php echo $row->id; ?>" onclick="isChecked(this.checked);" <?php echo $checked; ?>/></td>
<td nowrap align="left"><div id="hoverItem_ff_div<?php echo $row->id; ?>"><a href="#edit" onmouseout="unhighlightElement(<?php echo $i ?>)" onmouseover="highlightElement(<?php echo $i ?>)" onclick="return listItemTask('cb<?php echo $i; ?>','edit')"><?php echo $row->title; ?></a></div></td>
<td nowrap align="left"><?php echo $row->name; ?></td>
<td nowrap align="left"><?php echo HTML_facileFormsElement::displayType($row->type); ?></td>
<td nowrap align="center">
<?php
if ($row->published == "1") {
echo "<a href=\"#unpublish\" onClick=\"return listItemTask('cb".$i."','unpublish')\"><img src=\"components/com_breezingforms/images/icons/publish_g.png\" alt=\"+\" border=\"0\" /></a>";
} else {
echo "<a href=\"#publish\" onClick=\"return listItemTask('cb".$i."','publish')\"><img src=\"components/com_breezingforms/images/icons/publish_x.png\" alt=\"-\" border=\"0\" /></a>";
} // if
?>
</td>
<td nowrap align="right">
<?php
if ($i > 0)
echo "<a href=\"#orderup\" onClick=\"return listItemTask('cb".$i."','orderup')\"><img src=\"components/com_breezingforms/images/icons/uparrow.png\" alt=\"^\" border=\"0\" /></a>";
?>
</td>
<td nowrap align="left">
<?php
if ($i < count($rows)-1)
echo "<a href=\"#orderdown\" onClick=\"return listItemTask('cb".$i."','orderdown')\"><img src=\"components/com_breezingforms/images/icons/downarrow.png\" alt=\"v\" border=\"0\" /></a>";
?>
</td>
<td nowrap align="right"><?php echo $row->posx; if ($row->posxmode) echo '%'; else echo 'px'; ?></td>
<td nowrap align="right"><?php echo $row->posy; if ($row->posymode) echo '%'; else echo 'px'; ?></td>
<td nowrap align="right"><?php echo $row->id; ?></td>
<td></td>
</tr>
<?php
$k = 1 - $k;
} // for
?>
</table>
<?php
if ($form->prevmode > 0) {
if ($form->prevmode == 1) {
?>
<br /> <br />
<?php
} else {
?>
<script type="text/javascript" src="<?php echo JURI::root() . 'administrator/components/com_breezingforms/libraries/wz_dragdrop/wz_dragdrop.js' ?>"></script>
<!-- BEGIN OF SURFACE -->
<div id="SelectOptionDialog" style="position:absolute;top:233px;right:15px;z-index:100;">
<?php
}
?>
<table cellpadding="4" cellspacing="1" border="0" class="adminform" style="width:300px;">
<tr><th colspan="2" class="title">BreezingForms - <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PAGELAY'); ?></th></tr>
<tr>
<td colspan="2">
<table class="menubar" cellpadding="3" cellspacing="0" border="0">
<tr><td nowrap class="menudottedline" align="right">
<input onclick="submitbutton('addbefore');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_ELEMENTS_ADDPAGEBEFORE'), ENT_QUOTES, 'UTF-8'); ?>"/>
<input onclick="submitbutton('addbehind');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_ELEMENTS_ADDPAGEBEHIND'), ENT_QUOTES, 'UTF-8'); ?>"/>
<?php
if ($form->pages > 1) {
?>
<input onclick="submitbutton('movepage');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_ELEMENTS_MOVEPG'), ENT_QUOTES, 'UTF-8'); ?>"/>
<input onclick="submitbutton('delpage');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_ELEMENTS_DELPAGE'), ENT_QUOTES, 'UTF-8'); ?>"/>
<?php
} // if
?>
</td></tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table class="menubar" cellpadding="0" cellspacing="0" border="0">
<tr>
<td nowrap colspan="5" style="text-align:center">
<?php
if ($form->prevmode == 2) {
?>
<?php echo BFText::_('COM_BREEZINGFORMS_DRAGGING') ?> <br/> <?php echo BFText::_('COM_BREEZINGFORMS_DRAGGING_ON') ?> <input type="radio" id="draggingEnabled" name="dragToggle" onclick="dd.elements.SelectOptionDialog.setDraggable(true);"/> <?php echo BFText::_('COM_BREEZINGFORMS_DRAGGING_OFF') ?> <input id="draggingDisabled" checked type="radio" name="dragToggle" onclick="dd.elements.SelectOptionDialog.setDraggable(false);"/>
<br/>
<?php
}
?>
<input type="checkbox" id="gridshow" name="gridshow" onclick="submitbutton('gridshow');" value="1"<?php if ($ff_config->gridshow==1) echo ' checked="checked"'; ?> /><label for="gridshow"> <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_GRID'); ?></label>
<br/><hr/>
</td>
</tr>
<tr>
<td nowrap colspan="5" style="text-align:center">
<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MOVEPIX'); ?>:<br/>
<input type="text" size="6" maxlength="6" id="id_movepixels" name="movepixels" value="<?php echo is_int($ff_config->movepixels) ? is_int($ff_config->movepixels) : 5 ; ?>" class="inputbox"/>
<br/>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<a href="javascript:moveElements('up');">
<img src="<?php echo $ff_admicon; ?>/moveup_f2.png" width="16" height="16" alt="up" name="moveup" border="0" align="middle" />
</a>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>
<a href="javascript:moveElements('left');">
<img src="<?php echo $ff_admicon; ?>/movelt_f2.png" width="16" height="16" alt="left" name="moveleft" border="0" align="middle" />
</a>
</td>
<td></td>
<td>
<a href="javascript:moveElements('right');">
<img src="<?php echo $ff_admicon; ?>/movert_f2.png" width="16" height="16" alt="right" name="moveright" border="0" align="middle" />
</a>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<a href="javascript:moveElements('down');">
<img src="<?php echo $ff_admicon; ?>/movedn_f2.png" width="16" height="16" alt="down" name="movedown" border="0" align="middle" />
</a>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="5" style="text-align:center">
<input id="savepos" type="button" value="<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SAVE'); ?>" onclick="savePositions();" disabled="disabled"/><br/>
<input id="restpos" type="button" value="<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RESTORE'); ?>" onclick="restorePositions();" disabled="disabled"/>
<hr/>
</td>
</tr>
<tr>
<td colspan="5" style="text-align:center">
<?php
for ($p = 1; $p <= $form->pages; $p++) {
$attribute = '';
if ($p == $page) $attribute = 'disabled="disabled"';
echo '<input type="button" value="'.BFText::_('COM_BREEZINGFORMS_ELEMENTS_PAGE').' '.$p.'" onclick="changepage(\''.$p.'\');" '.$attribute.'/><br/>';
} // for
?>
</td>
</tr>
</table>
</td>
<td align="center">
<?php
if ($ff_config->stylesheet) {
// compose iframe url
$url =
$ff_mossite.'index.php'
.'?option=com_breezingforms'
.'&tmpl=component'
.'&Itemid=0'
.'&ff_form='.$form->id
.'&ff_frame=1'
.'&ff_runmode='._FF_RUNMODE_PREVIEW
.'&ff_page='.$page;
reset($ff_request);
while (list($prop, $val) = each($ff_request))
$url .= '&'.$prop.'='.urlencode($val);
// prepare iframe width
$framewidth = 'width="';
if ($form->widthmode)
$framewidth .= $form->prevwidth.'" ';
else
$framewidth .= $form->width.'" ';
// prepare iframe height
$frameheight = '';
if (!$form->heightmode) $frameheight = 'height="'.$form->height.'" ';
// assemble iframe parameters
$params =
'name="ff_prevframe" '.
'id="ff_prevframe" '.
'src="'.$url.'" '.
$framewidth.
$frameheight.
'frameborder="0" '.
'scrolling="no"';
?>
<iframe <?php echo $params; ?>>
<p><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BROWSER1'); ?></p>
<p><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BROWSER2'); ?></p>
</iframe>
<?php
} else {
$tstyle = ' style="';
$dstyle = '';
if ($form->widthmode) {
$tstyle .= 'width:'.$form->prevwidth.'px;';
} else {
$tstyle .= 'width:'.$form->width.'px;';
$dstyle .= 'width:'.$form->width.'px;';
} // else
if (!$form->heightmode) {
$tstyle .= 'height:'.$form->height.'px;';
$dstyle .= 'height:'.$form->height.'px;';
} // if
$tstyle .= '"';
?>
<table cellpadding="0" cellspacing="0" border="0"<?php echo $tstyle; ?>>
<tr><td>
<div style="position:relative;left:0px;top:0px;<?php echo $dstyle; ?>">
<?php
$myUser = JFactory::getUser();
$database->setQuery("select id from #__users where lower(username)=lower('".$myUser->get('username','')."')");
$id = $database->loadResult();
if ($id) $myUser->get('id',-1);
$curdir = getcwd();
chdir($ff_mospath);
$ff_processor = new HTML_facileFormsProcessor(_FF_RUNMODE_PREVIEW,false,$form->id,$page,$option);
if ($prevmode == 'submit') $ff_processor->submit(); else $ff_processor->view();
chdir($curdir);
?>
</div>
</td></tr>
</table>
<?php
} // if
?>
</td>
</tr>
</table>
<?php
if ($form->prevmode==2) {
?>
</div>
<script type="text/javascript">
<!--
SET_DHTML('SelectOptionDialog');
dd.elements.SelectOptionDialog.setDraggable(false);
//-->
</script>
<input type="hidden" id="ff_itemPositions" name="ff_itemPositions" value=""/>
<?php
} // if
} // if $form->prevmode > 0
?>
<input type="hidden" name="boxchecked" value="<?php echo $boxchecked; ?>" />
<input type="hidden" name="pkg" value="<?php echo $pkg; ?>" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" name="act" value="editpage" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="form" value="<?php echo $form->id; ?>" />
<input type="hidden" name="page" value="<?php echo $page; ?>" />
<input type="hidden" name="movepositions" value="" />
</form>
<?php
} // listitems
function getDestination($option, $pkg, $form, $page, &$ids, &$sellist, $action)
{
if ($action == 'copysave')
$title = BFText::_('COM_BREEZINGFORMS_ELEMENTS_COPY');
else
$title = BFText::_('COM_BREEZINGFORMS_ELEMENTS_MOVE');
?>
<script type="text/javascript">
<!--
var bf_submitbutton = function(pressbutton) {
var form = document.adminForm;
if (pressbutton == 'cancel') {
submitform( pressbutton );
return;
} // if
// do field validation
if (!getSelectedValue('adminForm', 'destination')) {
alert( "<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELFORMPAGE'); ?>" );
} else {
submitform( pressbutton );
} // if
} // submitbutton
if(typeof Joomla != "undefined"){
Joomla.submitbutton = bf_submitbutton;
}
submitbutton = bf_submitbutton;
//-->
</script>
<form action="index.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<table cellpadding="4" cellspacing="1" border="0" class="adminform" style="width:300px;">
<tr><th colspan="3" class="title"><?php echo $title; ?></th></tr>
<tr>
<td></td>
<td style="text-align:center" valign="top">
<strong><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TOFORMPAGE'); ?>:</strong>
<br/><br/><?php echo $sellist; ?><br /><br />
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap style="text-align:right">
<input onclick="submitbutton('<?php echo $action; ?>');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_TOOLBAR_CONTINUE'), ENT_QUOTES, 'UTF-8'); ?>"/>
<input onclick="submitbutton('cancel');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_TOOLBAR_CANCEL'), ENT_QUOTES, 'UTF-8'); ?>"/>
</td>
<td></td>
</tr>
</table>
<input type="hidden" name="pkg" value="<?php echo $pkg; ?>" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="act" value="editpage" />
<input type="hidden" name="form" value="<?php echo $form; ?>" />
<input type="hidden" name="page" value="<?php echo $page; ?>" />
<?php
if (count($ids)) foreach ($ids as $id) {
echo '<input type="hidden" name="ids[]" value="'.$id.'" />';
} // foreach
?>
</form>
<?php
} // getDestination
function getPagedest($option, $pkg, $form, $page, &$sellist)
{
?>
<script type="text/javascript">
<!--
function submitbutton(pressbutton) {
var form = document.adminForm;
if (pressbutton == 'cancel') {
submitform( pressbutton );
return;
} // if
// do field validation
if (!getSelectedValue('adminForm', 'destination')) {
alert( "<?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELPAGEMOVE'); ?>" );
} else {
submitform( pressbutton );
} // if
} // submitbutton
//-->
</script>
<form action="index.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<table cellpadding="4" cellspacing="1" border="0" class="adminform" style="width:300px;">
<tr><th colspan="3" class="title">BreezingForms - <?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MOVEPAGE'); ?></th></tr>
<tr>
<td></td>
<td style="text-align:center" valign="top">
<strong><?php echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELNRPAGE'); ?>:</strong>
<br/><br/><?php echo $sellist; ?><br /><br />
</td>
<td></td>
</tr>
<tr>
<td></td>
<td nowrap style="text-align:right">
<input onclick="submitbutton('movepagesave');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_TOOLBAR_CONTINUE'), ENT_QUOTES, 'UTF-8'); ?>"/>
<input onclick="submitbutton('cancel');" type="submit" value="<?php echo htmlentities(BFText::_('COM_BREEZINGFORMS_TOOLBAR_CANCEL'), ENT_QUOTES, 'UTF-8'); ?>"/>
</td>
<td></td>
</tr>
</table>
<input type="hidden" name="pkg" value="<?php echo $pkg; ?>" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="act" value="editpage" />
<input type="hidden" name="form" value="<?php echo $form; ?>" />
<input type="hidden" name="page" value="<?php echo $page; ?>" />
</form>
<?php
} // getPagedest
} // class HTML_facileFormsElement
?> | gpl-2.0 |
TeoTwawki/VirtualDub | src/samplefilter/source/main.cpp | 12541 | #include <vd2/plugin/vdvideofiltold.h>
#include <vd2/plugin/vdvideoutil.h>
#include <math.h>
#include <stdio.h>
#include <windows.h>
#include "resource.h"
HINSTANCE g_hInst;
///////////////////////////////////
int tutorial_null_run(const FilterActivation *fa, const FilterFunctions *ff) {
return 0;
}
long tutorial_null_param(FilterActivation *fa, const FilterFunctions *ff) {
fa->dst.offset = fa->src.offset;
return 0;
}
FilterDefinition filterDef_tutorial_null={
0,0,NULL, // next, prev, module (reserved)
"tutorial: null", // name
"Does nothing.", // desc
"Avery Lee", // author
NULL, // private data
0, // inst_data_size
NULL,NULL, // initProc, deinitProc
tutorial_null_run, // runProc
tutorial_null_param, // paramProc
};
///////////////////////////////////
static const int rtab[256]={
#define formula(x) 54*x+128
vd_maketable256
#undef formula
};
static const int gtab[256]={
#define formula(x) 183*x
vd_maketable256
#undef formula
};
static const int btab[256]={
#define formula(x) 19*x
vd_maketable256
#undef formula
};
int tutorial_grayscale_run(const FilterActivation *fa, const FilterFunctions *ff) {
vd_transform_pixmap_inplace(fa->dst) {
int r, g, b;
vd_pixunpack(px, r, g, b);
// px = 0x010101 * ((r*54 + g*183 + b*19 + 128) >> 8);
px = vd_pixavg_up(px, 0x010101 * ((rtab[r] + gtab[g] + btab[b]) >> 8));
}
return 0;
}
long tutorial_grayscale_param(FilterActivation *fa, const FilterFunctions *ff) {
fa->dst.offset = fa->src.offset;
return 0;
}
FilterDefinition filterDef_tutorial_grayscale={
0,0,NULL,
"tutorial: grayscale",
"Converts the incoming image to grayscale.",
"Avery Lee",
NULL,
0,
NULL,NULL,
tutorial_grayscale_run,
tutorial_grayscale_param,
NULL,
NULL,
};
///////////////////////////////////
int tutorial_pixeldouble_run(const FilterActivation *fa, const FilterFunctions *ff) {
vd_pixrow_iter srcrow(fa->src);
vd_pixrow_iter dstrow1(fa->dst, 0, 0);
vd_pixrow_iter dstrow2(fa->dst, 0, 1);
dstrow1.mulstep(2);
dstrow2.mulstep(2);
const int srcw = fa->src.w;
const int srch = fa->src.h;
for(int y=0; y<srch; ++y) {
for(int x=0; x<srcw; ++x) {
dstrow1[x*2] = dstrow1[x*2+1] = dstrow2[x*2] = dstrow2[x*2+1] = srcrow[x];
}
++dstrow1;
++dstrow2;
++srcrow;
}
return 0;
}
long tutorial_pixeldouble_param(FilterActivation *fa, const FilterFunctions *ff) {
fa->dst.w *= 2;
fa->dst.h *= 2;
fa->dst.AlignTo8();
return FILTERPARAM_SWAP_BUFFERS;
}
FilterDefinition filterDef_tutorial_pixeldouble={
0,0,NULL,
"tutorial: pixeldouble",
"Doubles an image's size.",
"Avery Lee",
NULL,
0,
NULL,NULL,
tutorial_pixeldouble_run,
tutorial_pixeldouble_param,
NULL,
NULL,
};
///////////////////////////////////
inline double lerp(double a, double b, double f) {
return a + (b-a)*f;
}
inline uint32 bilinear_fetch(const VFBitmap& src, double x, double y) {
// top, left clipping
if (x < 0)
x = 0;
if (y < 0)
y = 0;
// compute anchor pixel (top-left) and fractional offsets
int xi = (int)x;
int yi = (int)y;
double xf = x - xi;
double yf = y - yi;
// bottom, right clipping
if (xi >= src.w - 1) {
xi = src.w - 2;
xf = 1;
}
if (yi >= src.h - 1) {
yi = src.h - 2;
yf = 1;
}
// fetch 2x2 pixel square from source and unpack to RGB
vd_pixrow_iter row1(src, xi, yi);
vd_pixrow_iter row2(src, xi, yi+1);
int r1, g1, b1, r2, g2, b2, r3, g3, b3, r4, g4, b4;
vd_pixunpack(row1[0], r1, g1, b1);
vd_pixunpack(row1[1], r2, g2, b2);
vd_pixunpack(row2[0], r3, g3, b3);
vd_pixunpack(row2[1], r4, g4, b4);
// compute interpolated pixel and repack
int r_out = (int)lerp(lerp(r1, r2, xf), lerp(r3, r4, xf), yf);
int g_out = (int)lerp(lerp(g1, g2, xf), lerp(g3, g4, xf), yf);
int b_out = (int)lerp(lerp(b1, b2, xf), lerp(b3, b4, xf), yf);
return vd_pixpack(r_out, g_out, b_out);
}
int tutorial_pixeldouble_filtered_run(const FilterActivation *fa, const FilterFunctions *ff) {
vd_pixrow_iter dstrow(fa->dst, 0, 0);
const int dstw = fa->dst.w;
const int dsth = fa->dst.h;
for(int y=0; y<dsth; ++y) {
for(int x=0; x<dstw; ++x)
dstrow[x] = bilinear_fetch(fa->src, x*0.5-0.25, y*0.5-0.25);
++dstrow;
}
return 0;
}
int tutorial_pixeldouble_rotated_run(const FilterActivation *fa, const FilterFunctions *ff) {
vd_pixrow_iter dstrow(fa->dst, 0, 0);
const int dstw = fa->dst.w;
const int dsth = fa->dst.h;
static const double s = sin(10 * 3.1415926535897932 / 180.0);
static const double c = cos(10 * 3.1415926535897932 / 180.0);
const double xcen = fa->src.w*0.5 - 0.5;
const double ycen = fa->src.h*0.5 - 0.5;
for(int y=0; y<dsth; ++y) {
for(int x=0; x<dstw; ++x) {
double xc = x*0.5 - 0.25 - xcen;
double yc = y*0.5 - 0.25 - ycen;
double x2 = xcen + xc*c + yc*s;
double y2 = ycen - xc*s + yc*c;
dstrow[x] = bilinear_fetch(fa->src, x2, y2);
}
++dstrow;
}
return 0;
}
long tutorial_pixeldouble_filtered_param(FilterActivation *fa, const FilterFunctions *ff) {
fa->dst.w *= 2;
fa->dst.h *= 2;
fa->dst.AlignTo8();
return FILTERPARAM_SWAP_BUFFERS;
}
FilterDefinition filterDef_tutorial_pixeldouble_filtered={
0,0,NULL,
"tutorial: pixeldouble filtered",
"Doubles an image's size with bilinear filtering.",
"Avery Lee",
NULL,
0,
NULL,NULL,
tutorial_pixeldouble_filtered_run,
tutorial_pixeldouble_filtered_param,
NULL,
NULL,
};
FilterDefinition filterDef_tutorial_pixeldouble_rotated={
0,0,NULL,
"tutorial: pixeldouble rotated",
"Doubles an image's size and rotates it 10 degrees with bilinear filtering.",
"Avery Lee",
NULL,
0,
NULL,NULL,
tutorial_pixeldouble_rotated_run,
tutorial_pixeldouble_filtered_param,
NULL,
NULL,
};
////////////////////////////////////////////////////////////
struct TutorialSaturationFilterData {
double saturation;
IFilterPreview *ifp;
};
int tutorial_saturation_init(FilterActivation *fa, const FilterFunctions *ff) {
TutorialSaturationFilterData *pfd = (TutorialSaturationFilterData *)fa->filter_data;
pfd->saturation = 0.5;
return 0;
}
int tutorial_saturation_run(const FilterActivation *fa, const FilterFunctions *ff) {
TutorialSaturationFilterData *pfd = (TutorialSaturationFilterData *)fa->filter_data;
const int isat = (int)((1.0 - pfd->saturation) * 256.0);
const int inv_isat_256 = (256-isat) * 256;
vd_transform_pixmap_inplace(fa->dst) {
int r, g, b;
vd_pixunpack(px, r, g, b);
const int y = (r*54 + g*183 + b*19 + 128) * isat;
r = (r * inv_isat_256 + y + 32768) >> 16;
g = (g * inv_isat_256 + y + 32768) >> 16;
b = (b * inv_isat_256 + y + 32768) >> 16;
px = vd_pixpack(r, g, b);
}
return 0;
}
long tutorial_saturation_param(FilterActivation *fa, const FilterFunctions *ff) {
fa->dst.offset = fa->src.offset;
return 0;
}
INT_PTR CALLBACK tutorial_saturation_dlgproc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) {
TutorialSaturationFilterData *pfd = (TutorialSaturationFilterData *)GetWindowLongPtr(hdlg, DWLP_USER);
switch(msg) {
case WM_INITDIALOG:
SetWindowLongPtr(hdlg, DWLP_USER, lParam);
pfd = (TutorialSaturationFilterData *)lParam;
if (pfd->ifp)
pfd->ifp->InitButton(GetDlgItem(hdlg, IDC_PREVIEW));
SetDlgItemInt(hdlg, IDC_VALUE, (int)(0.5 + pfd->saturation*100), FALSE);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK:
{
BOOL bValid;
UINT v = GetDlgItemInt(hdlg, IDC_VALUE, &bValid, FALSE);
if (!bValid || v > 100) {
MessageBeep(MB_ICONEXCLAMATION);
SetFocus(GetDlgItem(hdlg, IDC_VALUE));
return FALSE;
}
pfd->saturation = (int)v / 100.0;
}
EndDialog(hdlg, TRUE);
return TRUE;
case IDCANCEL:
EndDialog(hdlg, FALSE);
return TRUE;
case IDC_VALUE:
if (HIWORD(wParam) == EN_KILLFOCUS) {
BOOL bValid;
UINT v = GetDlgItemInt(hdlg, IDC_VALUE, &bValid, FALSE);
if (bValid && v <= 100) {
pfd->saturation = (int)v / 100.0;
if (pfd->ifp)
pfd->ifp->RedoFrame();
}
}
return TRUE;
case IDC_PREVIEW:
if (pfd->ifp)
pfd->ifp->Toggle(hdlg);
return TRUE;
}
break;
}
return FALSE;
}
int tutorial_saturation_config(FilterActivation *fa, const FilterFunctions *ff, HWND hWnd) {
TutorialSaturationFilterData *pfd = (TutorialSaturationFilterData *)fa->filter_data;
// cache filter preview interface
pfd->ifp = fa->ifp;
// cache original configuration
TutorialSaturationFilterData fd_temp(*pfd);
// display dialog
if (!DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER_TUTORIAL_SATURATION), hWnd, tutorial_saturation_dlgproc, (LPARAM)fa->filter_data)) {
// user hit cancel -- rollback changes
*pfd = fd_temp;
return TRUE;
}
return FALSE;
}
void tutorial_saturation_string(const FilterActivation *fa, const FilterFunctions *ff, char *buf) {
fa->filter->stringProc2(fa, ff, buf, 100);
}
void tutorial_saturation_string2(const FilterActivation *fa, const FilterFunctions *ff, char *buf, int maxlen) {
TutorialSaturationFilterData *pfd = (TutorialSaturationFilterData *)fa->filter_data;
_snprintf(buf, maxlen, " (%d%%)", (int)(0.5 + 100.0*pfd->saturation));
}
bool tutorial_saturation_fss(FilterActivation *fa, const FilterFunctions *ff, char *buf, int maxlen) {
TutorialSaturationFilterData *pfd = (TutorialSaturationFilterData *)fa->filter_data;
_snprintf(buf, maxlen, "Config(%d)", (int)(0.5 + 10000.0*pfd->saturation));
return true;
}
static void tutorial_saturation_script_config(IScriptInterpreter *isi, void *lpVoid, CScriptValue *argv, int argc) {
FilterActivation *fa = (FilterActivation *)lpVoid;
TutorialSaturationFilterData *pfd = (TutorialSaturationFilterData *)fa->filter_data;
pfd->saturation = argv[0].asInt() / 10000.0;
}
static ScriptFunctionDef tutorial_saturation_func_defs[]={
{ (ScriptFunctionPtr)tutorial_saturation_script_config, "Config", "0i" },
{ NULL },
};
static CScriptObject tutorial_saturation_obj={
NULL, tutorial_saturation_func_defs
};
FilterDefinition filterDef_tutorial_saturation={
0,0,NULL,
"tutorial: saturation",
"Adjusts a video's saturation.",
"Avery Lee",
NULL,
sizeof(TutorialSaturationFilterData),
tutorial_saturation_init,
NULL,
tutorial_saturation_run,
tutorial_saturation_param,
tutorial_saturation_config,
tutorial_saturation_string,
NULL,
NULL,
&tutorial_saturation_obj,
tutorial_saturation_fss,
tutorial_saturation_string2
};
////////////////////////////////////////////////////////////
extern FilterDefinition filterDef_supersample;
namespace {
FilterDefinition *const g_filters[]={
&filterDef_tutorial_null,
&filterDef_tutorial_grayscale,
&filterDef_tutorial_pixeldouble,
&filterDef_tutorial_pixeldouble_filtered,
&filterDef_tutorial_pixeldouble_rotated,
&filterDef_tutorial_saturation,
};
enum {
kFilterCount = sizeof g_filters / sizeof g_filters[0]
};
FilterDefinition *g_installedFilters[kFilterCount];
}
////////////////////////////////////////////////////////////
extern "C" int __declspec(dllexport) __cdecl VirtualdubFilterModuleCheckVersion();
extern "C" int __declspec(dllexport) __cdecl VirtualdubFilterModuleInit2(FilterModule *fm, const FilterFunctions *ff, int& vdfd_ver, int& vdfd_compat);
extern "C" void __declspec(dllexport) __cdecl VirtualdubFilterModuleDeinit(FilterModule *fm, const FilterFunctions *ff);
int __declspec(dllexport) __cdecl VirtualdubFilterModuleCheckVersion() {
return VIRTUALDUB_FILTERDEF_VERSION;
}
int __declspec(dllexport) __cdecl VirtualdubFilterModuleInit2(FilterModule *fm, const FilterFunctions *ff, int& vdfd_ver, int& vdfd_compat) {
for(int i=0; i<kFilterCount; ++i)
g_installedFilters[i] = ff->addFilter(fm, g_filters[i], sizeof(FilterDefinition));
vdfd_ver = VIRTUALDUB_FILTERDEF_VERSION;
vdfd_compat = 9; // copy constructor support required
g_hInst = fm->hInstModule;
return 0;
}
void __declspec(dllexport) __cdecl VirtualdubFilterModuleDeinit(FilterModule *fm, const FilterFunctions *ff) {
for(int i=0; i<kFilterCount; ++i)
if (g_installedFilters[i]) {
ff->removeFilter(g_installedFilters[i]);
g_installedFilters[i] = 0;
}
}
| gpl-2.0 |
nihrain/accelerate | wp-content/plugins/ninja-forms/includes/admin/edit-field/req.php | 1178 | <?php if ( ! defined( 'ABSPATH' ) ) exit;
add_action('init', 'ninja_forms_register_edit_field_required');
function ninja_forms_register_edit_field_required(){
add_action('nf_edit_field_restrictions', 'ninja_forms_field_required', 9, 2 );
}
function ninja_forms_field_required( $field_id, $field_data ) {
global $ninja_forms_fields;
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$reg_field = $ninja_forms_fields[$field_type];
$edit_req = $reg_field['edit_req'];
if($edit_req){
if(isset($field_data['req'])){
$req = $field_data['req'];
}else{
$req = '';
}
ninja_forms_edit_field_el_output($field_id, 'checkbox', __( 'Required', 'ninja-forms' ), 'req', $req, 'wide' );
}
}
function nf_edit_field_req( $field_id, $field_data ) {
global $ninja_forms_fields;
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$reg_field = $ninja_forms_fields[$field_type];
$field_req = $reg_field['req'];
if ( $field_req ) {
ninja_forms_edit_field_el_output($field_id, 'hidden', '', 'req', 1);
}
}
add_action( 'ninja_forms_edit_field_before_registered', 'nf_edit_field_req', 10, 2 );
| gpl-2.0 |
s-duret/centreon | www/api/index.php | 4986 | <?php
/*
* Copyright 2005-2015 Centreon
* Centreon is developped by : Julien Mathis and Romain Le Merlus under
* GPL Licence 2.0.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation ; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see <http://www.gnu.org/licenses>.
*
* Linking this program statically or dynamically with other modules is making a
* combined work based on this program. Thus, the terms and conditions of the GNU
* General Public License cover the whole combination.
*
* As a special exception, the copyright holders of this program give Centreon
* permission to link this program with independent modules to produce an executable,
* regardless of the license terms of these independent modules, and to copy and
* distribute the resulting executable under terms of Centreon choice, provided that
* Centreon also meet, for each linked independent module, the terms and conditions
* of the license of that module. An independent module is a module which is not
* derived from this program. If you modify this program, you may extend this
* exception to your version of the program, but you are not obliged to do so. If you
* do not wish to do so, delete this exception statement from your version.
*
* For more information : contact@centreon.com
*
*/
require_once realpath(dirname(__FILE__) . "/../../config/centreon.config.php");
require_once _CENTREON_PATH_ . 'www/class/centreon.class.php';
require_once _CENTREON_PATH_ . "/www/class/centreonDB.class.php";
require_once dirname(__FILE__) . '/class/webService.class.php';
require_once dirname(__FILE__) . '/exceptions.php';
$pearDB = new CentreonDB();
/* Purge old token */
$pearDB->query("DELETE FROM ws_token WHERE generate_date < DATE_SUB(NOW(), INTERVAL 1 HOUR)");
/* Test if the call is for authenticate */
if ($_SERVER['REQUEST_METHOD'] === 'POST' &&
isset($_GET['action']) && $_GET['action'] == 'authenticate') {
if (false === isset($_POST['username']) || false === isset($_POST['password'])) {
CentreonWebService::sendJson("Bad parameters", 400);
}
/* @todo Check if user already have valid token */
require_once _CENTREON_PATH_ . "/www/class/centreonLog.class.php";
require_once _CENTREON_PATH_ . "/www/class/centreonAuth.class.php";
/* Authenticate the user */
$log = new CentreonUserLog(0, $pearDB);
$auth = new CentreonAuth($_POST['username'], $_POST['password'], 0, $pearDB, $log, 1, "", "API");
if ($auth->passwdOk == 0) {
CentreonWebService::sendJson("Bad credentials", 403);
exit();
}
/* Check if user exists in contact table */
$reachAPI = 0;
$res = $pearDB->prepare("SELECT contact_id, reach_api, reach_api_rt, contact_admin
FROM contact
WHERE contact_activate = '1' AND contact_register = '1' AND contact_alias = ?");
$res = $pearDB->execute($res, array($_POST['username']));
while ($data = $res->fetchRow()) {
if (isset($data['contact_admin']) && $data['contact_admin'] == 1) {
$reachAPI = 1;
} else {
if (isset($data['reach_api']) && $data['reach_api'] == 1) {
$reachAPI = 1;
} else if (isset($data['reach_api_rt']) && $data['reach_api_rt'] == 1) {
$reachAPI = 1;
}
}
}
/* Sorry no access for this user */
if ($reachAPI == 0) {
CentreonWebService::sendJson("Unauthorized - Account not enabled", 401);
exit();
}
/* Insert Token in API webservice session table */
$token = base64_encode(uniqid('', true));
$res = $pearDB->prepare("INSERT INTO ws_token (contact_id, token, generate_date) VALUES (?, ?, NOW())");
$pearDB->execute($res, array($auth->userInfos['contact_id'], $token));
/* Send Data in Json */
CentreonWebService::sendJson(array('authToken' => $token));
}
/* Test authentication */
if (false === isset($_SERVER['HTTP_CENTREON_AUTH_TOKEN'])) {
CentreonWebService::sendJson("Unauthorized", 401);
}
/* Create the default object */
$res = $pearDB->prepare("SELECT c.* FROM ws_token w, contact c WHERE c.contact_id = w.contact_id AND token = ?");
$res = $pearDB->execute($res, array($_SERVER['HTTP_CENTREON_AUTH_TOKEN']));
if (PEAR::isError($res)) {
CentreonWebService::sendJson("Database error", 500);
}
$userInfos = $res->fetchRow();
if (is_null($userInfos)) {
CentreonWebService::sendJson("Unauthorized", 401);
}
$centreon = new Centreon($userInfos);
$oreon = $centreon;
CentreonWebService::router($centreon->user);
| gpl-2.0 |
henriquespedro/Autarquia-Livre | backend/views/viewer-group/index.php | 2077 | <?php
use yii\helpers\Html;
use yii\grid\GridView;
use app\models\Group;
/* @var $this yii\web\View */
/* @var $searchModel app\models\ViewerGroupSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Segurança';
$this->params['breadcrumbs'][] = ['label' => 'Visualizador', 'url' => array('viewers/update', 'id' => $_GET['viewer_id'], 'viewer_id' => $_GET['viewer_id'])];
$this->params['breadcrumbs'][] = 'Segurança';
?>
<div class="viewer-group-index">
<p>
<b>ATENÇÃO:</b> Para ativar protecção ás configurações e/ou layers, tem que adicionar os grupos pretendidos. Caso a tabela não possua nenhum grupo indentificado não será adicionada segurança ao visualizador.
</p>
<p>
<?= Html::a('Novo Grupo', ['create', 'viewer_id' => $_GET['viewer_id']], ['class' => 'btn btn-success']) ?>
</p>
<?=
GridView::widget([
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'group_id',
'label' => 'Grupo',
'format' => 'text', //raw, html
'content' => function($data) {
return Group::find()->where("id=" . $data->group_id)->one()->description;
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'urlCreator' => function ($action, $model, $key, $index) {
if ($action === 'update') {
$url = array('viewer-group/update', 'id' => $model->id, 'viewer_id' => $model->viewer_id);
return $url;
}
if ($action === 'delete') {
$url = array('viewer-group/delete', 'id' => $model->id, 'viewer_id' => $model->viewer_id);
return $url;
}
}],
],
]);
?>
</div>
| gpl-2.0 |
edom-huang/myBlog | vendor/bower_dl/pickadate/tests/jquery.1.7.0.js | 312376 | /*!
* jQuery JavaScript Library v1.7
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Nov 3 16:18:21 2011 -0400
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator,
location = window.location;
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Check for digits
rdigit = /\d/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// The deferred used on DOM ready
readyList,
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = quickExpr.exec( selector );
}
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = ( context ? context.ownerDocument || context : document );
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec( selector );
if ( ret ) {
if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createElement( ret[1] ) ];
}
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
}
return jQuery.merge( this, selector );
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.7",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return slice.call( this, 0 );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = this.constructor();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
}
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
// Add the callback
readyList.add( fn );
return this;
},
eq: function( i ) {
return i === -1 ?
this.slice( i ) :
this.slice( i, +i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.fireWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger( "ready" ).unbind( "ready" );
}
}
},
bindReady: function() {
if ( readyList ) {
return;
}
readyList = jQuery.Callbacks( "once memory" );
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
// A crude way of determining if an object is a window
isWindow: function( obj ) {
return obj && typeof obj === "object" && "setInterval" in obj;
},
isNumeric: function( obj ) {
return obj != null && rdigit.test( obj ) && !isNaN( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw msg;
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
if ( args ) {
if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( object[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
break;
}
}
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function( text ) {
return text == null ?
"" :
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
},
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// The window, strings (and functions) also have 'length'
// The extra typeof function check is to prevent crashes
// in Safari 2 (See: #3039)
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
}
return ret;
},
inArray: function( elem, array, i ) {
var len;
if ( array ) {
if ( indexOf ) {
return indexOf.call( array, elem, i );
}
len = array.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in array && array[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key, ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
if ( typeof context === "string" ) {
var tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
var args = slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
return proxy;
},
// Mutifunctional method to get and set values to a collection
// The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
jQuery.access( elems, k, key[k], exec, fn, value );
}
return elems;
}
// Setting one attribute
if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = !pass && exec && jQuery.isFunction(value);
for ( var i = 0; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
return elems;
}
// Getting an attribute
return length ? fn( elems[0], key ) : undefined;
},
now: function() {
return ( new Date() ).getTime();
},
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
var match = rwebkit.exec( ua ) ||
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
sub: function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
},
browser: {}
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
jQuery.browser.version = browserMatch.version;
}
// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}
// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
} else if ( document.attachEvent ) {
DOMContentLoaded = function() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
};
}
// The DOM ready check for Internet Explorer
function doScrollCheck() {
if ( jQuery.isReady ) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
// and execute any waiting functions
jQuery.ready();
}
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
return jQuery;
})();
// String to Object flags format cache
var flagsCache = {};
// Convert String-formatted flags into Object-formatted ones and store in cache
function createFlags( flags ) {
var object = flagsCache[ flags ] = {},
i, length;
flags = flags.split( /\s+/ );
for ( i = 0, length = flags.length; i < length; i++ ) {
object[ flags[i] ] = true;
}
return object;
}
/*
* Create a callback list using the following parameters:
*
* flags: an optional list of space-separated flags that will change how
* the callback list behaves
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible flags:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( flags ) {
// Convert flags from String-formatted to Object-formatted
// (we check in cache first)
flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
var // Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = [],
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Add one or several callbacks to the list
add = function( args ) {
var i,
length,
elem,
type,
actual;
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
// Inspect recursively
add( elem );
} else if ( type === "function" ) {
// Add if not in unique mode and callback is not in
if ( !flags.unique || !self.has( elem ) ) {
list.push( elem );
}
}
}
},
// Fire callbacks
fire = function( context, args ) {
args = args || [];
memory = !flags.memory || [ context, args ];
firing = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
memory = true; // Mark as halted
break;
}
}
firing = false;
if ( list ) {
if ( !flags.once ) {
if ( stack && stack.length ) {
memory = stack.shift();
self.fireWith( memory[ 0 ], memory[ 1 ] );
}
} else if ( memory === true ) {
self.disable();
} else {
list = [];
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
var length = list.length;
add( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away, unless previous
// firing was halted (stopOnFalse)
} else if ( memory && memory !== true ) {
firingStart = length;
fire( memory[ 0 ], memory[ 1 ] );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
var args = arguments,
argIndex = 0,
argLength = args.length;
for ( ; argIndex < argLength ; argIndex++ ) {
for ( var i = 0; i < list.length; i++ ) {
if ( args[ argIndex ] === list[ i ] ) {
// Handle firingIndex and firingLength
if ( firing ) {
if ( i <= firingLength ) {
firingLength--;
if ( i <= firingIndex ) {
firingIndex--;
}
}
}
// Remove the element
list.splice( i--, 1 );
// If we have some unicity property then
// we only need to do this once
if ( flags.unique ) {
break;
}
}
}
}
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
if ( list ) {
var i = 0,
length = list.length;
for ( ; i < length; i++ ) {
if ( fn === list[ i ] ) {
return true;
}
}
}
return false;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory || memory === true ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( stack ) {
if ( firing ) {
if ( !flags.once ) {
stack.push( [ context, args ] );
}
} else if ( !( flags.once && memory ) ) {
fire( context, args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!memory;
}
};
return self;
};
var // Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
Deferred: function( func ) {
var doneList = jQuery.Callbacks( "once memory" ),
failList = jQuery.Callbacks( "once memory" ),
progressList = jQuery.Callbacks( "memory" ),
state = "pending",
lists = {
resolve: doneList,
reject: failList,
notify: progressList
},
promise = {
done: doneList.add,
fail: failList.add,
progress: progressList.add,
state: function() {
return state;
},
// Deprecated
isResolved: doneList.fired,
isRejected: failList.fired,
then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
return this;
},
always: function() {
return deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
},
pipe: function( fnDone, fnFail, fnProgress ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ],
progress: [ fnProgress, "notify" ]
}, function( handler, data ) {
var fn = data[ 0 ],
action = data[ 1 ],
returned;
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
deferred[ handler ]( newDefer[ action ] );
}
});
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
if ( obj == null ) {
obj = promise;
} else {
for ( var key in promise ) {
obj[ key ] = promise[ key ];
}
}
return obj;
}
},
deferred = promise.promise({}),
key;
for ( key in lists ) {
deferred[ key ] = lists[ key ].fire;
deferred[ key + "With" ] = lists[ key ].fireWith;
}
// Handle state
deferred.done( function() {
state = "resolved";
}, failList.disable, progressList.lock ).fail( function() {
state = "rejected";
}, doneList.disable, progressList.lock );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = sliceDeferred.call( arguments, 0 ),
i = 0,
length = args.length,
pValues = new Array( length ),
count = length,
pCount = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred(),
promise = deferred.promise();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
deferred.resolveWith( deferred, args );
}
};
}
function progressFunc( i ) {
return function( value ) {
pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
deferred.notifyWith( promise, pValues );
};
}
if ( length > 1 ) {
for ( ; i < length; i++ ) {
if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return promise;
}
});
jQuery.support = (function() {
var div = document.createElement( "div" ),
documentElement = document.documentElement,
all,
a,
select,
opt,
input,
marginDiv,
support,
fragment,
body,
testElementParent,
testElement,
testElementStyle,
tds,
events,
eventName,
i,
isSupported;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/><nav></nav>";
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
// Can't get basic test support
if ( !all || !all.length || !a ) {
return {};
}
// First batch of supports tests
select = document.createElement( "select" );
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName( "input" )[ 0 ];
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName( "tbody" ).length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName( "link" ).length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.55/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure unknown elements (like HTML5 elems) are handled appropriately
unknownElems: !!div.getElementsByTagName( "nav" ).length,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form(#6743)
enctype: !!document.createElement("form").enctype,
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent( "onclick" );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute("type", "radio");
support.radioValue = input.value === "t";
input.setAttribute("checked", "checked");
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
div.innerHTML = "";
// Figure out if the W3C box model works as expected
div.style.width = div.style.paddingLeft = "1px";
// We don't want to do body-related feature tests on frameset
// documents, which lack a body. So we use
// document.getElementsByTagName("body")[0], which is undefined in
// frameset documents, while document.body isn’t. (7398)
body = document.getElementsByTagName("body")[ 0 ];
// We use our own, invisible, body unless the body is already present
// in which case we use a div (#9239)
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
background: "none"
};
if ( body ) {
jQuery.extend( testElementStyle, {
position: "absolute",
left: "-999px",
top: "-999px"
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
support.boxModel = div.offsetWidth === 2;
if ( "zoom" in div.style ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layouts
// (IE < 8 does this)
div.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
// Check if elements with layouts shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
}
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE < 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
div.innerHTML = "";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( document.defaultView && document.defaultView.getComputedStyle ) {
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for( i in {
submit: 1,
change: 1,
focusin: 1
} ) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
// Run fixed position tests at doc ready to avoid a crash
// related to the invisible body in IE8
jQuery(function() {
var container, outer, inner, table, td, offsetSupport,
conMarginTop = 1,
ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",
vb = "visibility:hidden;border:0;",
style = "style='" + ptlm + "border:5px solid #000;padding:0;'",
html = "<div " + style + "><div></div></div>" +
"<table " + style + " cellpadding='0' cellspacing='0'>" +
"<tr><td></td></tr></table>";
// Reconstruct a container
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
// These tests cannot be done
return;
}
container = document.createElement("div");
container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
body.insertBefore( container, body.firstChild );
// Construct a test element
testElement = document.createElement("div");
testElement.style.cssText = ptlm + vb;
testElement.innerHTML = html;
container.appendChild( testElement );
outer = testElement.firstChild;
inner = outer.firstChild;
td = outer.nextSibling.firstChild.firstChild;
offsetSupport = {
doesNotAddBorder: ( inner.offsetTop !== 5 ),
doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
};
inner.style.position = "fixed";
inner.style.top = "20px";
// safari subtracts parent border width here which is 5px
offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
inner.style.position = inner.style.top = "";
outer.style.overflow = "hidden";
outer.style.position = "relative";
offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
body.removeChild( container );
testElement = container = null;
jQuery.extend( support, offsetSupport );
});
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
// Null connected elements to avoid leaks in IE
testElement = fragment = select = opt = body = marginDiv = div = input = null;
return support;
})();
// Keep track of boxModel
jQuery.boxModel = jQuery.support.boxModel;
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var privateCache, thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando,
isEvents = name === "events";
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ jQuery.expando ] = id = ++jQuery.uuid;
} else {
id = jQuery.expando;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
privateCache = thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Users should not attempt to inspect the internal events object using jQuery.data,
// it is undocumented and subject to change. But does anyone listen? No.
if ( isEvents && !thisCache[ name ] ) {
return privateCache.events;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
// Reference to internal data cache key
internalKey = jQuery.expando,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
// See jQuery.data for more information
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support space separated names
if ( jQuery.isArray( name ) ) {
name = name;
} else if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split( " " );
}
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject(cache[ id ]) ) {
return;
}
}
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
// Ensure that `cache` is not a window object #10080
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the cache and need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
if ( isNode ) {
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( jQuery.support.deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
} else {
elem[ jQuery.expando ] = null;
}
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, attr, name,
data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
data = jQuery.data( this[0] );
if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) {
attr = this[0].attributes;
for ( var i = 0, l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( this[0], name, data[ name ] );
}
}
jQuery._data( this[0], "parsedAttrs", true );
}
}
return data;
} else if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
// Try to fetch any internally stored data first
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
data = dataAttr( this[0], key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else {
return this.each(function() {
var $this = jQuery( this ),
args = [ parts[0], value ];
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
$this.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
jQuery.isNumeric( data ) ? parseFloat( data ) :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
for ( var name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery._data( elem, deferDataKey );
if ( defer &&
( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery._data( elem, queueDataKey ) &&
!jQuery._data( elem, markDataKey ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.fire();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = ( type || "fx" ) + "mark";
jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
if ( count ) {
jQuery._data( elem, key, count );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
var q;
if ( elem ) {
type = ( type || "fx" ) + "queue";
q = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
hooks = {};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
jQuery._data( elem, type + ".run", hooks );
fn.call( elem, function() {
jQuery.dequeue( elem, type );
}, hooks );
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue " + type + ".run", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
return this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
count++;
tmp.add( resolve );
}
}
resolve();
return defer.promise();
}
});
var rclass = /[\n\t\r]/g,
rspace = /\s+/,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
nodeHook, boolHook, fixSpecified;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.attr );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classNames, i, l, elem, className, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
classNames = ( value || "" ).split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.className = "";
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return undefined;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, i, max, option,
index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
i = one ? index : 0;
max = one ? index + 1 : options.length;
for ( ; i < max; i++ ) {
option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if ( one && !values.length && options.length ) {
return jQuery( options[ index ] ).val();
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( !("getAttribute" in elem) ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return undefined;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, "" + value );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, l,
i = 0;
if ( elem.nodeType === 1 ) {
attrNames = ( value || "" ).split( rspace );
l = attrNames.length;
for ( ; i < l; i++ ) {
name = attrNames[ i ].toLowerCase();
propName = jQuery.propFix[ name ] || name;
// See #9699 for explanation of this approach (setting first, then removal)
jQuery.attr( elem, name, "" );
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( rboolean.test( name ) && propName in elem ) {
elem[ propName ] = false;
}
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
ret.nodeValue :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return ( ret.nodeValue = value + "" );
}
};
// Apply the nodeHook to tabindex
jQuery.attrHooks.tabindex.set = nodeHook.set;
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = "" + value );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
rspaces = / /g,
rescape = /[^\w\s.|`]/g,
rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
rhoverHack = /\bhover(\.\S+)?/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
quickParse = function( selector ) {
var quick = rquickIs.exec( selector );
if ( quick ) {
// 0 1 2 3
// [ _, tag, id, class ]
quick[1] = ( quick[1] || "" ).toLowerCase();
quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
}
return quick;
},
quickIs = function( elem, m ) {
return (
(!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
(!m[2] || elem.id === m[2]) &&
(!m[3] || m[3].test( elem.className ))
);
},
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, quick, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = hoverHack(types).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
namespace: namespaces.join(".")
}, handleObjIn );
// Delegated event; pre-analyze selector so it's processed quickly on event dispatch
if ( selector ) {
handleObj.quick = quickParse( selector );
if ( !handleObj.quick && jQuery.expr.match.POS.test( selector ) ) {
handleObj.isPositional = true;
}
}
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector ) {
var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
t, tns, type, namespaces, origCount,
j, events, special, handle, eventType, handleObj;
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = hoverHack( types || "" ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
namespaces = namespaces? "." + namespaces : "";
for ( j in events ) {
jQuery.event.remove( elem, j + namespaces, handler, selector );
}
return;
}
special = jQuery.event.special[ type ] || {};
type = ( selector? special.delegateType : special.bindType ) || type;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
// Only need to loop for special events or selective removal
if ( handler || namespaces || selector || special.remove ) {
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( !handler || handler.guid === handleObj.guid ) {
if ( !namespaces || namespaces.test( handleObj.namespace ) ) {
if ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
}
}
} else {
// Removing all events
eventType.length = 0;
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, [ "events", "handle" ], true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var type = event.type || event,
namespaces = [],
cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
if ( type.indexOf( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) {
event.preventDefault();
}
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
old = null;
for ( cur = elem.parentNode; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old && old === elem.ownerDocument ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length; i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) ) {
handle.apply( cur, data );
}
if ( event.isPropagationStopped() ) {
break;
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = [].slice.call( arguments, 0 ),
run_all = !event.exclusive && !event.namespace,
specialHandle = ( jQuery.event.special[ event.type ] || {} ).handle,
handlerQueue = [],
i, j, cur, ret, selMatch, matched, matches, handleObj, sel, hit, related;
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Determine handlers that should run if there are delegated events
// Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) {
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
selMatch = {};
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
hit = selMatch[ sel ];
if ( handleObj.isPositional ) {
// Since .is() does not work for positionals; see http://jsfiddle.net/eJ4yd/3/
hit = ( hit || (selMatch[ sel ] = jQuery( sel )) ).index( cur ) >= 0;
} else if ( hit === undefined ) {
hit = selMatch[ sel ] = ( handleObj.quick ? quickIs( cur, handleObj.quick ) : jQuery( cur ).is( sel ) );
}
if ( hit ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( specialHandle || handleObj.handler ).apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
return event.result;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement wheelDelta".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
if ( event.metaKey === undefined ) {
event.metaKey = event.ctrlKey;
}
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady
},
focus: {
delegateType: "focusin",
noBubble: true
},
blur: {
delegateType: "focusout",
noBubble: true
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = jQuery.event.special[ fix ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector,
oldType, ret;
// For a real mouseover/out, always call the handler; for
// mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || handleObj.origType === event.type || (related !== target && !jQuery.contains( target, related )) ) {
oldType = event.type;
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = oldType;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !form._submit_attached ) {
jQuery.event.add( form, "submit._submit", function( event ) {
// Form was submitted, bubble the event up the tree
if ( this.parentNode ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
});
form._submit_attached = true;
}
});
// return undefined since we don't need an event listener
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed ) {
this._just_changed = false;
jQuery.event.simulate( "change", this, event, true );
}
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
elem._change_attached = true;
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on.call( this, types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
var handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( var type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.bind( name, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
expando = "sizcache" + (Math.random() + '').replace('.', ''),
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
rReturn = /\r\n/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context, seed );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set, seed );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set, i, len, match, type, left;
if ( !expr ) {
return [];
}
for ( i = 0, len = Expr.order.length; i < len; i++ ) {
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace( rBackslash, "" );
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( "*" ) :
[];
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
type, found, item, filter, left,
i, pass,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
filter = Expr.filter[ type ];
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
pass = not ^ found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw "Syntax error, unrecognized expression: " + msg;
};
/**
* Utility function for retreiving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
var getText = Sizzle.getText = function( elem ) {
var i, node,
nodeType = elem.nodeType,
ret = "";
if ( nodeType ) {
if ( nodeType === 1 ) {
// Use textContent || innerText for elements
if ( typeof elem.textContent === 'string' ) {
return elem.textContent;
} else if ( typeof elem.innerText === 'string' ) {
// Replace IE's carriage returns
return elem.innerText.replace( rReturn, '' );
} else {
// Traverse it's children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
} else {
// If no nodeType, this is expected to be an array
for ( i = 0; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
if ( node.nodeType !== 8 ) {
ret += getText( node );
}
}
}
return ret;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
},
type: function( elem ) {
return elem.getAttribute( "type" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !rNonWord.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !rNonWord.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace( rBackslash, "" ) + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace( rBackslash, "" );
},
TAG: function( match, curLoop ) {
return match[1].replace( rBackslash, "" ).toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
match[2] = match[2].replace(/^\+|\s*/g, '');
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
else if ( match[2] ) {
Sizzle.error( match[0] );
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
// Handle if an un-quoted value was used
match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
parent: function( elem ) {
return !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
},
radio: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},
checkbox: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},
file: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},
password: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},
submit: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},
image: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},
reset: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "reset" === elem.type;
},
button: function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},
focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( name );
}
},
CHILD: function( elem, match ) {
var first, last,
doneName, parent, cache,
count, diff,
type = match[1],
node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
first = match[2];
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
doneName = match[0];
parent = elem.parentNode;
if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent[ expando ] = doneName;
}
diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Sizzle.attr ?
Sizzle.attr( elem, name ) :
Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
!type && Sizzle.attr ?
result != null :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG")
if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra );
}
}
if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it
if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) {
var elem = context.getElementById( match[3] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra );
}
} else {
return makeArray( [], extra );
}
}
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var oldContext = context,
old = context.getAttribute( "id" ),
nid = old || id,
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test( query );
if ( !old ) {
context.setAttribute( "id", nid );
} else {
nid = nid.replace( /'/g, "\\$&" );
}
if ( relativeHierarchySelector && hasParent ) {
context = context.parentNode;
}
try {
if ( !relativeHierarchySelector || hasParent ) {
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
}
} catch(pseudoError) {
} finally {
if ( !old ) {
oldContext.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || !disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9, so check for that
node.document && node.document.nodeType !== 11 ) {
return ret;
}
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context, seed ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet, seed );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
Sizzle.selectors.attrMap = {};
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.POS,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
var ret = this.pushStack( "", "find", selector ),
length, n, r;
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
POS.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array (deprecated as of jQuery 1.7)
if ( jQuery.isArray( selectors ) ) {
var level = 1;
while ( cur && cur.ownerDocument && cur !== context ) {
for ( i = 0; i < selectors.length; i++ ) {
if ( jQuery( cur ).is( selectors[ i ] ) ) {
ret.push({ selector: selectors[ i ], elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
return ret;
}
// String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
break;
}
}
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( elem.parentNode.firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until ),
// The variable 'args' was introduced in
// https://github.com/jquery/jquery/commit/52a0238
// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
// http://code.google.com/p/v8/issues/detail?id=1050
args = slice.call(arguments);
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, args.join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( " " ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr article aside audio canvas datalist details figcaption figure footer " +
"header hgroup mark meter nav output progress section summary time video",
rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames.replace(" ", "|") + ")", "i"),
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
},
safeFragment = createSafeFragment( document );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
var self = jQuery( this );
self.text( text.call(this, i, self.text()) );
});
}
if ( typeof text !== "object" && text !== undefined ) {
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
return jQuery.text( this );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
return this.each(function() {
jQuery( this ).wrapAll( html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery(arguments[0]);
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery(arguments[0]).toArray() );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) {
jQuery.cleanData( this[i].getElementsByTagName("*") );
this[i].innerHTML = value;
}
}
// If using innerHTML throws an exception, use the fallback method
} catch(e) {
this.empty().append( value );
}
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery( this );
self.html( value.call(this, i, self.html()) );
});
} else {
this.empty().append( value );
}
return this;
},
replaceWith: function( value ) {
if ( this[0] && this[0].parentNode ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
} else {
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
}
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call(this, i, table ? self.html() : undefined);
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
// Make sure that we do not leak memory by inadvertently discarding
// the original fragment (which might have attached data) instead of
// using it; in addition, use the original fragment object for the last
// item instead of first because it can end up being emptied incorrectly
// in certain situations (Bug #8070).
// Fragments from the fragment cache must always be cloned and never used
// in place.
results.cacheable || ( l > 1 && i < lastIndex ) ?
jQuery.clone( fragment, true, true ) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, evalScript );
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
if ( src.checked ) {
dest.defaultChecked = dest.checked = src.checked;
}
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc,
first = args[ 0 ];
// nodes may contain either an explicit document object,
// a jQuery collection or context object.
// If nodes[0] contains a valid object to assign to doc
if ( nodes && nodes[0] ) {
doc = nodes[0].ownerDocument || nodes[0];
}
// Ensure that an attr object doesn't incorrectly stand in as a document object
// Chrome and Firefox seem to allow this to occur and will throw exception
// Fixes #8950
if ( !doc.createDocumentFragment ) {
doc = document;
}
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
first.charAt(0) === "<" && !rnocache.test( first ) &&
(jQuery.support.checkClone || !rchecked.test( first )) &&
(!jQuery.support.unknownElems && rnoshimcache.test( first )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ first ];
if ( cacheresults && cacheresults !== 1 ) {
fragment = cacheresults;
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ first ] = cacheresults ? fragment : 1;
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = ( i > 0 ? this.clone(true) : this ).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( typeof elem.getElementsByTagName !== "undefined" ) {
return elem.getElementsByTagName( "*" );
} else if ( typeof elem.querySelectorAll !== "undefined" ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( elem.type === "checkbox" || elem.type === "radio" ) {
elem.defaultChecked = elem.checked;
}
}
// Finds all inputs and passes them to fixDefaultChecked
function findInputs( elem ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "input" ) {
fixDefaultChecked( elem );
// Skip scripts, get other children
} else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var clone = elem.cloneNode(true),
srcElements,
destElements,
i;
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName
// instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var checkScriptType;
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [], j;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
// Append wrapper element to unknown element safe doc fragment
if ( context === document ) {
// Use the fragment we've already created for this document
safeFragment.appendChild( div );
} else {
// Use a fragment created with the owner document
createSafeFragment( context ).appendChild( div );
}
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = rtbody.test(elem),
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
}
}
// Resets defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
checkScriptType = function( elem ) {
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 ) {
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( ret[i] );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id,
cache = jQuery.cache,
special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ];
if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
function evalScript( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
rrelNum = /^([\-+])=([\-+.\de]+)/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
cssHeight = [ "Top", "Bottom" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
if ( arguments.length === 2 && value === undefined ) {
return this;
}
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
});
};
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity", "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra ) {
var ret, hooks;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// cssFloat needs a special treatment
if ( name === "cssFloat" ) {
name = "float";
}
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
}
});
// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
jQuery.each(["height", "width"], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
var val;
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
return val;
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat( value );
if ( value >= 0 ) {
return value + "px";
}
} else {
return value;
}
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layouts
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
jQuery(function() {
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
var ret;
jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
ret = curCSS( elem, "margin-right", "marginRight" );
} else {
ret = elem.style.marginRight;
}
});
return ret;
}
};
}
});
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( !(defaultView = elem.ownerDocument.defaultView) ) {
return undefined;
}
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft, uncomputed,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret === null && style && (uncomputed = style[ name ]) ) {
ret = uncomputed;
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
// Remember the original values
left = style.left;
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ( ret || 0 );
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
which = name === "width" ? cssWidth : cssHeight;
if ( val > 0 ) {
if ( extra !== "border" ) {
jQuery.each( which, function() {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
});
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ] || 0;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
jQuery.each( which, function() {
val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
}
});
}
return val + "px";
}
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
if ( jQuery.isFunction( func ) ) {
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
i = 0,
length = dataTypes.length,
dataType,
list,
placeBefore;
// For each dataType in the dataTypeExpression
for ( ; i < length; i++ ) {
dataType = dataTypes[ i ];
// We control if we're asked to add before
// any existing element
placeBefore = /^\+/.test( dataType );
if ( placeBefore ) {
dataType = dataType.substr( 1 ) || "*";
}
list = structure[ dataType ] = structure[ dataType ] || [];
// then we add to the structure accordingly
list[ placeBefore ? "unshift" : "push" ]( func );
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
dataType /* internal */, inspected /* internal */ ) {
dataType = dataType || options.dataTypes[ 0 ];
inspected = inspected || {};
inspected[ dataType ] = true;
var list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters ),
selection;
for ( ; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR );
// If we got redirected to another dataType
// we try there if executing only and not done already
if ( typeof selection === "string" ) {
if ( !executeOnly || inspected[ selection ] ) {
selection = undefined;
} else {
options.dataTypes.unshift( selection );
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, selection, inspected );
}
}
}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, "*", inspected );
}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection;
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
}
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
} else if ( !this.length ) {
return this;
}
var off = url.indexOf( " " );
if ( off >= 0 ) {
var selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params ) {
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
// Complete callback (responseText is used internally)
complete: function( jqXHR, status, responseText ) {
// Store the response as specified by the jqXHR object
responseText = jqXHR.responseText;
// If successful, inject the HTML into all the matched elements
if ( jqXHR.isResolved() ) {
// #4825: Get the actual response in case
// a dataFilter is present in ajaxSettings
jqXHR.done(function( r ) {
responseText = r;
});
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
responseText );
}
if ( callback ) {
self.each( callback, [ responseText, status, jqXHR ] );
}
}
});
return this;
},
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray( this.elements ) : this;
})
.filter(function(){
return this.name && !this.disabled &&
( this.checked || rselectTextarea.test( this.nodeName ) ||
rinput.test( this.type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.bind( o, f );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
traditional: false,
headers: {},
*/
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": allTypes
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
context: true,
url: true
}
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// The jqXHR state
state = 0,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Fake xhr
jqXHR = {
readyState: 0,
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Cancel the request
abort: function( statusText ) {
statusText = statusText || "abort";
if ( transport ) {
transport.abort( statusText );
}
done( 0, statusText );
return this;
}
};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) {
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
var isSuccess,
success,
error,
statusText = nativeStatusText,
response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
lastModified,
etag;
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
jQuery.lastModified[ ifModifiedKey ] = lastModified;
}
if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
jQuery.etag[ ifModifiedKey ] = etag;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
try {
success = ajaxConvert( s, response );
statusText = "success";
isSuccess = true;
} catch(e) {
// We have a parsererror
statusText = "parsererror";
error = e;
}
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( !statusText || status ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = "" + ( nativeStatusText || statusText );
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.add;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for ( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.then( tmp, tmp );
}
}
return this;
};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
// Determine if a cross-domain request is in order
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefiler, stop there
if ( state === 2 ) {
return false;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey = s.url;
// Add anti-cache in url if needed
if ( s.cache === false ) {
var ts = jQuery.now(),
// try replacing _= if it is there
ret = s.url.replace( rts, "$1_=" + ts );
// if nothing was replaced, add timestamp to the end
s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
ifModifiedKey = ifModifiedKey || s.url;
if ( jQuery.lastModified[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
}
if ( jQuery.etag[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
}
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already
jqXHR.abort();
return false;
}
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
jQuery.error( e );
}
}
}
return jqXHR;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : value;
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( var prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
}
});
function buildParams( prefix, obj, traditional, add ) {
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && obj != null && typeof obj === "object" ) {
// Serialize object item.
for ( var name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields,
ct,
type,
finalDataType,
firstDataType;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
var dataTypes = s.dataTypes,
converters = {},
i,
key,
length = dataTypes.length,
tmp,
// Current and previous dataTypes
current = dataTypes[ 0 ],
prev,
// Conversion expression
conversion,
// Conversion function
conv,
// Conversion functions (transitive conversion)
conv1,
conv2;
// For each dataType in the chain
for ( i = 1; i < length; i++ ) {
// Create converters map
// with lowercased keys
if ( i === 1 ) {
for ( key in s.converters ) {
if ( typeof key === "string" ) {
converters[ key.toLowerCase() ] = s.converters[ key ];
}
}
}
// Get the dataTypes
prev = current;
current = dataTypes[ i ];
// If current is auto dataType, update it to prev
if ( current === "*" ) {
current = prev;
// If no auto and dataTypes are actually different
} else if ( prev !== "*" && prev !== current ) {
// Get the converter
conversion = prev + " " + current;
conv = converters[ conversion ] || converters[ "* " + current ];
// If there is no direct converter, search transitively
if ( !conv ) {
conv2 = undefined;
for ( conv1 in converters ) {
tmp = conv1.split( " " );
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
conv2 = converters[ tmp[1] + " " + current ];
if ( conv2 ) {
conv1 = converters[ conv1 ];
if ( conv1 === true ) {
conv = conv2;
} else if ( conv2 === true ) {
conv = conv1;
}
break;
}
}
}
}
// If we found no converter, dispatch an error
if ( !( conv || conv2 ) ) {
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
}
// If found converter is not an equivalence
if ( conv !== true ) {
// Convert with 1 or 2 converters accordingly
response = conv ? conv( response ) : conv2( conv1(response) );
}
}
}
return response;
}
var jsc = jQuery.now(),
jsre = /(\=)\?(&|$)|\?\?/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
( typeof s.data === "string" );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
inspectData && jsre.test( s.data ) ) ) {
var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2";
if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
}
}
}
s.url = url;
s.data = data;
// Install callback
window[ jsonpCallback ] = function( response ) {
responseContainer = [ response ];
};
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( jsonpCallback + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Delegate to script
return "script";
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0,
xhrCallbacks;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var xhr = s.xhr(),
handle,
i;
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occured
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
responses.text = xhr.responseText;
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
// if we're in sync mode or it's in cache
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
callback();
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
],
fxNow;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback );
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
display = elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( display === "" && jQuery.css(elem, "display") === "none" ) {
jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
}
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
var elem, display,
i = 0,
j = this.length;
for ( ; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = jQuery.css( elem, "display" );
if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
jQuery._data( elem, "olddisplay", display );
}
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
if ( this[i].style ) {
this[i].style.display = "none";
}
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed( speed, easing, callback );
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete, [ false ] );
}
// Do not change referenced properties as per-property easing will be lost
prop = jQuery.extend( {}, prop );
function doAnimation() {
// XXX 'this' does not always have a nodeName when running the
// test suite
if ( optall.queue === false ) {
jQuery._mark( this );
}
var opt = jQuery.extend( {}, optall ),
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
name, val, p, e,
parts, start, end, unit,
method;
// will store per property easing and be used to determine when an animation is complete
opt.animatedProperties = {};
for ( p in prop ) {
// property name normalization
name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
}
val = prop[ name ];
// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
if ( jQuery.isArray( val ) ) {
opt.animatedProperties[ name ] = val[ 1 ];
val = prop[ name ] = val[ 0 ];
} else {
opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
}
if ( val === "hide" && hidden || val === "show" && !hidden ) {
return opt.complete.call( this );
}
if ( isElement && ( name === "height" || name === "width" ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layouts
if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.zoom = 1;
}
}
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
for ( p in prop ) {
e = new jQuery.fx( this, opt, p );
val = prop[ p ];
if ( rfxtypes.test( val ) ) {
// Tracks whether to show or hide based on private
// data attached to the element
method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
if ( method ) {
jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
e[ method ]();
} else {
e[ val ]();
}
} else {
parts = rfxnum.exec( val );
start = e.cur();
if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( this, p, (end || 1) + unit);
start = ( (end || 1) / e.cur() ) * start;
jQuery.style( this, p, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
}
// For JS strict compliance
return true;
}
return optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var i,
hadTimers = false,
timers = jQuery.timers,
data = jQuery._data( this );
// clear marker counters if we know they won't be
if ( !gotoEnd ) {
jQuery._unmark( true, this );
}
function stopQueue( elem, data, i ) {
var hooks = data[ i ];
jQuery.removeData( elem, i, true );
hooks.stop( gotoEnd );
}
if ( type == null ) {
for ( i in data ) {
if ( data[ i ].stop && i.indexOf(".run") === i.length - 4 ) {
stopQueue( this, data, i );
}
}
} else if ( data[ i = type + ".run" ] && data[ i ].stop ){
stopQueue( this, data, i );
}
for ( i = timers.length; i--; ) {
if ( timers[ i ].elem === this && (type == null || timers[ i ].queue === type) ) {
if ( gotoEnd ) {
// force the next step to be the last
timers[ i ]( true );
} else {
timers[ i ].saveState();
}
hadTimers = true;
timers.splice( i, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( !( gotoEnd && hadTimers ) ) {
jQuery.dequeue( this, type );
}
});
}
});
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}
function clearFxNow() {
fxNow = undefined;
}
// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx( "show", 1 ),
slideUp: genFx( "hide", 1 ),
slideToggle: genFx( "toggle", 1 ),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.extend({
speed: function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
options.orig = options.orig || {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
},
// Get the current size
cur: function() {
if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
return this.elem[ this.prop ];
}
var parsed,
r = jQuery.css( this.elem, this.prop );
// Empty strings, null, undefined and "auto" are converted to 0,
// complex values such as "rotate(1rad)" are returned as is,
// simple values such as "10px" are parsed to Float.
return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;
this.startTime = fxNow || createFxNow();
this.end = to;
this.now = this.start = from;
this.pos = this.state = 0;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
function t( gotoEnd ) {
return self.step( gotoEnd );
}
t.queue = this.options.queue;
t.elem = this.elem;
t.saveState = function() {
if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
jQuery._data( self.elem, "fxshow" + self.prop, self.start );
}
};
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval( fx.tick, fx.interval );
}
},
// Simple 'show' function
show: function() {
var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any flash of content
if ( dataShow !== undefined ) {
// This show is picking up where a previous hide or show left off
this.custom( this.cur(), dataShow );
} else {
this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
}
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom( this.cur(), 0 );
},
// Each step of an animation
step: function( gotoEnd ) {
var p, n, complete,
t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options;
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
options.animatedProperties[ this.prop ] = true;
for ( p in options.animatedProperties ) {
if ( options.animatedProperties[ p ] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
jQuery.each( [ "", "X", "Y" ], function( index, value ) {
elem.style[ "overflow" + value ] = options.overflow[ index ];
});
}
// Hide the element if the "hide" operation was done
if ( options.hide ) {
jQuery( elem ).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show ) {
for ( p in options.animatedProperties ) {
jQuery.style( elem, p, options.orig[ p ] );
jQuery.removeData( elem, "fxshow" + p, true );
// Toggle data is no longer needed
jQuery.removeData( elem, "toggle" + p, true );
}
}
// Execute the complete function
// in the event that the complete function throws an exception
// we must ensure it won't be called twice. #5684
complete = options.complete;
if ( complete ) {
options.complete = false;
complete.call( elem );
}
}
return false;
} else {
// classical easing cannot be used with an Infinity duration
if ( options.duration == Infinity ) {
this.now = t;
} else {
n = t - this.startTime;
this.state = n / options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
this.now = this.start + ( (this.end - this.start) * this.pos );
}
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
var timer,
timers = jQuery.timers,
i = 0;
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
// Adds width/height step functions
// Do not set anything below 0
jQuery.each([ "width", "height" ], function( i, prop ) {
jQuery.fx.step[ prop ] = function( fx ) {
jQuery.style( fx.elem, prop, Math.max(0, fx.now) );
};
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var body = document.body,
elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// No iframe to use yet, so create it
if ( !iframe ) {
iframe = document.createElement( "iframe" );
iframe.frameBorder = iframe.width = iframe.height = 0;
}
body.appendChild( iframe );
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
iframeDoc.body.appendChild( elem );
display = jQuery.css( elem, "display" );
body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
var rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
var elem = this[0], box;
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
try {
box = elem.getBoundingClientRect();
} catch(e) {}
var doc = elem.ownerDocument,
docElem = doc.documentElement;
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow(doc),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
doc = elem.ownerDocument,
docElem = doc.documentElement,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.offset = {
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return null;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( ["Left", "Top"], function( i, name ) {
var method = "scroll" + name;
jQuery.fn[ method ] = function( val ) {
var elem, win;
if ( val === undefined ) {
elem = this[ 0 ];
if ( !elem ) {
return null;
}
win = getWindow( elem );
// Return the scroll offset
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
// Set the scroll offset
return this.each(function() {
win = getWindow( this );
if ( win ) {
win.scrollTo(
!i ? val : jQuery( win ).scrollLeft(),
i ? val : jQuery( win ).scrollTop()
);
} else {
this[ method ] = val;
}
});
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
this[ type ]() :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
this[ type ]() :
null;
};
jQuery.fn[ type ] = function( size ) {
// Get window width or height
var elem = this[0];
if ( !elem ) {
return size == null ? null : this;
}
if ( jQuery.isFunction( size ) ) {
return this.each(function( i ) {
var self = jQuery( this );
self[ type ]( size.call( this, i, self[ type ]() ) );
});
}
if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
var docElemProp = elem.document.documentElement[ "client" + name ],
body = elem.document.body;
return elem.document.compatMode === "CSS1Compat" && docElemProp ||
body && body[ "client" + name ] || docElemProp;
// Get document width or height
} else if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
return Math.max(
elem.documentElement["client" + name],
elem.body["scroll" + name], elem.documentElement["scroll" + name],
elem.body["offset" + name], elem.documentElement["offset" + name]
);
// Get or set width or height on the element
} else if ( size === undefined ) {
var orig = jQuery.css( elem, type ),
ret = parseFloat( orig );
return jQuery.isNumeric( ret ) ? ret : orig;
// Set the width or height on the element (default to pixels if value is unitless)
} else {
return this.css( type, typeof size === "string" ? size : size + "px" );
}
};
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
})( window ); | gpl-2.0 |
hardvain/mono-compiler | class/System.Design/System.Windows.Forms.Design/ParentControlDesigner.cs | 22435 | //
// System.Windows.Forms.Design.ParentControlDesigner
//
// Authors:
// Ivan N. Zlatev (contact i-nZ.net)
//
// (C) 2006 Ivan N. Zlatev
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Design;
using System.Collections;
using System.Windows.Forms.Design.Behavior;
namespace System.Windows.Forms.Design
{
public class ParentControlDesigner : ControlDesigner
{
public ParentControlDesigner ()
{
}
#region Initialization
// Settings paths taken from the example at:
// http://msdn2.microsoft.com/en-us/library/system.componentmodel.design.idesigneroptionservice.aspx
//
public override void Initialize (IComponent component)
{
base.Initialize (component);
this.Control.AllowDrop = true;
// Initialize the default values of the Design-Time properties.
//
_defaultDrawGrid = true;
_defaultSnapToGrid = true;
_defaultGridSize = new Size (8, 8);
// If the parent Control of the designed one has a ParentDesigner then inherit the values
// from it's designer.
//
if (this.Control.Parent != null) {
ParentControlDesigner parentDesigner = GetParentControlDesignerOf (Control.Parent);
if (parentDesigner != null) {
_defaultDrawGrid = (bool) GetValue (parentDesigner.Component, "DrawGrid");
_defaultSnapToGrid = (bool) GetValue (parentDesigner.Component, "SnapToGrid");
_defaultGridSize = (Size) GetValue (parentDesigner.Component, "GridSize");
}
}
else {
// Else retrieve them through the IDesignerOptionService (if available)
//
IDesignerOptionService options = GetService (typeof (IDesignerOptionService)) as
IDesignerOptionService;
if (options != null) {
object value = null;
value = options.GetOptionValue (@"WindowsFormsDesigner\General", "DrawGrid");
if (value is bool)
_defaultDrawGrid = (bool) value;
value = options.GetOptionValue (@"WindowsFormsDesigner\General", "SnapToGrid");
if (value is bool)
_defaultSnapToGrid = (bool) value;
value = options.GetOptionValue (@"WindowsFormsDesigner\General", "GridSize");
if (value is Size)
_defaultGridSize = (Size) value;
}
}
IComponentChangeService componentChangeSvc = GetService (typeof (IComponentChangeService)) as IComponentChangeService;
if (componentChangeSvc != null) {
componentChangeSvc.ComponentRemoving += new ComponentEventHandler (OnComponentRemoving);
componentChangeSvc.ComponentRemoved += new ComponentEventHandler (OnComponentRemoved);
}
// At the end set whatever we've managed to get
//
_drawGrid = _defaultDrawGrid;
_snapToGrid = _defaultSnapToGrid;
_gridSize = _defaultGridSize;
}
protected override void Dispose (bool disposing)
{
if (disposing) {
EnableDragDrop (false);
OnMouseDragEnd (true);
}
base.Dispose (disposing);
}
#endregion
#region IToolboxService Related
// This is the code that is executed when you drop a tool from the Toolbox in the designer.
//
protected static void InvokeCreateTool (ParentControlDesigner toInvoke, ToolboxItem tool)
{
if (toInvoke != null)
toInvoke.CreateTool (tool);
}
protected void CreateTool (ToolboxItem tool)
{
CreateToolCore (tool, DefaultControlLocation.X, DefaultControlLocation.Y, 0, 0, true, false);
}
protected void CreateTool (ToolboxItem tool, Point location)
{
CreateToolCore (tool, location.X, location.Y, 0, 0, true, false);
}
protected void CreateTool (ToolboxItem tool, Rectangle bounds)
{
CreateToolCore (tool, bounds.X, bounds.Y, bounds.Width, bounds.Width, true, true);
}
// Creates a component from a ToolboxItem, sets its location and size if available and snaps it's
// location to the grid.
//
protected virtual IComponent[] CreateToolCore (ToolboxItem tool, int x, int y, int width, int height,
bool hasLocation, bool hasSize)
{
if (tool == null)
throw new ArgumentNullException ("tool");
IDesignerHost host = GetService (typeof (IDesignerHost)) as IDesignerHost;
DesignerTransaction transaction = host.CreateTransaction ("Create components in tool '" + tool.DisplayName + "'");
IComponent[] components = tool.CreateComponents (host);
foreach (IComponent component in components)
{
ControlDesigner controlDesigner = host.GetDesigner (component) as ControlDesigner;
if (controlDesigner == null) { // not a Control, but e.g. a plain Component
continue;
} else if (!this.CanParent (controlDesigner)) {
host.DestroyComponent (component);
continue;
}
Control control = component as Control;
if (control != null) {
this.Control.SuspendLayout ();
// set parent instead of controls.Add so that it gets serialized for Undo/Redo
TypeDescriptor.GetProperties (control)["Parent"].SetValue (control, this.Control);
this.Control.SuspendLayout ();
if (hasLocation)
base.SetValue (component, "Location", this.SnapPointToGrid (new Point (x, y)));
else
base.SetValue (component, "Location", this.SnapPointToGrid (this.DefaultControlLocation));
if (hasSize)
base.SetValue (component, "Size", new Size (width, height));
this.Control.Refresh ();
}
}
ISelectionService selectionServ = this.GetService (typeof (ISelectionService)) as ISelectionService;
if (selectionServ != null)
selectionServ.SetSelectedComponents (components, SelectionTypes.Replace);
transaction.Commit ();
return components;
}
#endregion
#region Drag and Drop
// If the control is not already parented return true
//
public virtual bool CanParent (Control control)
{
if (control != null)
return !control.Contains (this.Control);
return false;
}
public virtual bool CanParent (ControlDesigner designer)
{
return CanParent (designer.Control);
}
protected override void OnDragDrop (DragEventArgs e)
{
IUISelectionService selectionServ = this.GetService (typeof (IUISelectionService)) as IUISelectionService;
if (selectionServ != null) {
// once this is fired the parent control (parentcontroldesigner) will start getting dragover events.
//
Point location = this.SnapPointToGrid (this.Control.PointToClient (new Point (e.X, e.Y)));
selectionServ.DragDrop (false, this.Control, location.X, location.Y);
}
}
protected override void OnDragEnter (DragEventArgs e)
{
this.Control.Refresh ();
}
protected override void OnDragLeave (EventArgs e)
{
this.Control.Refresh ();
}
protected override void OnDragOver (DragEventArgs e)
{
IUISelectionService selectionServ = this.GetService (typeof (IUISelectionService)) as IUISelectionService;
if (selectionServ != null) {
// once ControlDesigner.MouseDragBegin is called this will start getting dragover events.
//
Point location = this.SnapPointToGrid (this.Control.PointToClient (new Point (e.X, e.Y)));
selectionServ.DragOver (this.Control, location.X, location.Y);
}
e.Effect = DragDropEffects.Move;
}
#endregion
#region Properties
// The default location where a control is placed, when added to the designer
//
protected virtual Point DefaultControlLocation {
get { return new Point (0, 0); }
}
protected override bool EnableDragRect {
get { return true; }
}
#endregion
#region ComponentChange
private void OnComponentRemoving (object sender, ComponentEventArgs args)
{
IComponentChangeService componentChangeSvc = GetService (typeof (IComponentChangeService)) as IComponentChangeService;
Control control = args.Component as Control;
if (control != null && control.Parent == this.Control && componentChangeSvc != null)
componentChangeSvc.OnComponentChanging (args.Component, TypeDescriptor.GetProperties (args.Component)["Parent"]);
}
private void OnComponentRemoved (object sender, ComponentEventArgs args)
{
IComponentChangeService componentChangeSvc = GetService (typeof (IComponentChangeService)) as IComponentChangeService;
Control control = args.Component as Control;
if (control != null && control.Parent == this.Control && componentChangeSvc != null) {
control.Parent = null;
componentChangeSvc.OnComponentChanged (args.Component,
TypeDescriptor.GetProperties (args.Component)["Parent"],
this.Control, null);
}
}
#endregion
#region Design-Time Properties
private bool _defaultDrawGrid;
private bool _defaultSnapToGrid;
private Size _defaultGridSize;
private bool _drawGrid;
private bool _snapToGrid;
private Size _gridSize;
//This method adds the following design-time browsable properties:
// "DrawGrid", "SnapToGrid", and "GridSize".
//
protected override void PreFilterProperties (IDictionary properties)
{
base.PreFilterProperties (properties);
properties["DrawGrid"] = TypeDescriptor.CreateProperty (typeof (ParentControlDesigner),
"DrawGrid",
typeof (bool),
new Attribute[] {
BrowsableAttribute.Yes,
DesignOnlyAttribute.Yes,
new DescriptionAttribute (
"Indicates whether or not to draw the positioning grid."),
CategoryAttribute.Design
});
properties["SnapToGrid"] = TypeDescriptor.CreateProperty (typeof (ParentControlDesigner),
"SnapToGrid",
typeof (bool),
new Attribute[] {
BrowsableAttribute.Yes,
DesignOnlyAttribute.Yes,
new DescriptionAttribute (
"Determines if controls should snap to the positioning grid."),
CategoryAttribute.Design
});
properties["GridSize"] = TypeDescriptor.CreateProperty (typeof (ParentControlDesigner),
"GridSize",
typeof (Size),
new Attribute[] {
BrowsableAttribute.Yes,
DesignOnlyAttribute.Yes,
new DescriptionAttribute (
"Determines the size of the positioning grid."),
CategoryAttribute.Design
});
}
// Informs all children controls' ParentControlDesigners that the grid properties
// have changed and passes them
//
private void PopulateGridProperties ()
{
// Control.Invalidate (true) will redraw the control and it's children
// this will cause a WM_PAINT message to be send and the ControlDesigenr will raise
// the OnPaintAdornments, where the grid drawing takes place.
//
// Note that this should be called *after* the grid properties have changed :-)
//
this.Control.Invalidate (false);
if (this.Control != null) {
ParentControlDesigner designer = null;
foreach (Control control in this.Control.Controls) {
designer = this.GetParentControlDesignerOf (control);
if (designer != null)
designer.OnParentGridPropertiesChanged (this);
}
}
}
// Called by the parent ParentControlDesigner when it is populating the grid-related
// design-time properties changes
//
private void OnParentGridPropertiesChanged (ParentControlDesigner parentDesigner)
{
SetValue (this.Component, "DrawGrid", (bool) GetValue (parentDesigner.Component, "DrawGrid"));
SetValue (this.Component, "SnapToGrid", (bool) GetValue (parentDesigner.Component, "SnapToGrid"));
SetValue (this.Component, "GridSize", (Size) GetValue (parentDesigner.Component, "GridSize"));
// Set also the default values to be those, because we should
// match the parent ParentControlDesigner values.
// called recursivly, so I will rather go for slower, but no stack-overflowable code
//
_defaultDrawGrid = (bool) GetValue (parentDesigner.Component, "DrawGrid");
_defaultSnapToGrid = (bool) GetValue (parentDesigner.Component, "SnapToGrid");
_defaultGridSize = (Size) GetValue (parentDesigner.Component, "GridSize");
this.PopulateGridProperties ();
}
// Retrieves the ParentControlDesigner of the specified control if available,
// else returns null.
//
private ParentControlDesigner GetParentControlDesignerOf (Control control)
{
if (control != null) {
IDesignerHost designerHost = GetService (typeof (IDesignerHost)) as IDesignerHost;
if (designerHost != null) {
ParentControlDesigner designer = null;
designer = designerHost.GetDesigner (this.Control.Parent) as ParentControlDesigner;
if (designer != null)
return designer;
}
}
return null;
}
protected virtual bool DrawGrid {
get { return _drawGrid; }
set {
_drawGrid = value;
if (value == false)
SetValue (this.Component, "SnapToGrid", false);
PopulateGridProperties ();
}
}
private bool SnapToGrid {
get { return _snapToGrid; }
set {
_snapToGrid = value;
PopulateGridProperties ();
}
}
protected Size GridSize {
get { return _gridSize; }
set {
_gridSize = value;
PopulateGridProperties ();
}
}
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconshouldpersistresetmethods.asp
//
// The ShouldSerializerPROPERTYNAME determines whether a property has changed from
// the default value and should get serialized.
//
// The ResetPROPERTYNAME resets the property to it's default value (used when
// one right clicks on a property in the property grid and clicks on "Reset".
//
private bool ShouldSerializeDrawGrid ()
{
return DrawGrid != _defaultDrawGrid;
}
private void ResetDrawGrid ()
{
this.DrawGrid = _defaultDrawGrid;
}
private bool ShouldSerializeSnapToGrid ()
{
return _drawGrid != _defaultDrawGrid;
}
private void ResetSnapToGrid ()
{
this.SnapToGrid = _defaultSnapToGrid;
}
private bool ShouldSerializeGridSize ()
{
return GridSize != _defaultGridSize;
}
private void ResetGridSize ()
{
this.GridSize = _defaultGridSize;
}
#endregion
#region Design-Time Mouse Drag and Drop
protected override void OnMouseDragBegin (int x, int y)
{
// do not call base here because the behaviour is specific for the ControlDesgner (does IUISelectionService.DragBegin)
//
IUISelectionService selectionServ = this.GetService (typeof (IUISelectionService)) as IUISelectionService;
if (selectionServ != null) {
// once ControlDesigner.MouseDragBegin is fired this will start getting dragover events.
//
Point location = new Point (x, y);
IDesignerHost host = GetService (typeof (IDesignerHost)) as IDesignerHost;
if (base.MouseButtonDown == MouseButtons.Middle && host != null && host.RootComponent != this.Control) {
location = this.Control.Parent.PointToClient (this.Control.PointToScreen (new Point (x, y)));
// I have to do this, because I get DragOver events fired for the control I am actually dragging
//
this.Control.AllowDrop = false;
selectionServ.DragBegin ();
}
else {
selectionServ.MouseDragBegin (this.Control, location.X, location.Y);
}
}
}
protected override void OnMouseDragMove (int x, int y)
{
IUISelectionService selectionServ = this.GetService (typeof (IUISelectionService)) as IUISelectionService;
if (selectionServ != null) {
Point location = new Point (x, y);
if (!selectionServ.SelectionInProgress)
location = this.SnapPointToGrid (new Point (x, y));
selectionServ.MouseDragMove (location.X, location.Y);
}
}
protected override void OnMouseDragEnd (bool cancel)
{
IUISelectionService selectionServ = this.GetService (typeof (IUISelectionService)) as IUISelectionService;
if (selectionServ != null) {
// If there is a Toolbox component seleted then create it instead of finishing the selection
IToolboxService toolBoxService = this.GetService (typeof (IToolboxService)) as IToolboxService;
if (!cancel && toolBoxService != null && toolBoxService.GetSelectedToolboxItem () != null) {
if (selectionServ.SelectionInProgress) {
bool hasSize = selectionServ.SelectionBounds.Width > 0 &&
selectionServ.SelectionBounds.Height > 0;
CreateToolCore (toolBoxService.GetSelectedToolboxItem (),
selectionServ.SelectionBounds.X,
selectionServ.SelectionBounds.Y,
selectionServ.SelectionBounds.Width,
selectionServ.SelectionBounds.Height,
true, hasSize);
toolBoxService.SelectedToolboxItemUsed ();
cancel = true;
} else if (!selectionServ.SelectionInProgress &&
!selectionServ.ResizeInProgress && !selectionServ.DragDropInProgress){
CreateTool (toolBoxService.GetSelectedToolboxItem (), _mouseDownPoint);
toolBoxService.SelectedToolboxItemUsed ();
cancel = true;
}
}
if (selectionServ.SelectionInProgress || selectionServ.ResizeInProgress)
selectionServ.MouseDragEnd (cancel);
}
}
protected override void OnDragComplete (DragEventArgs de)
{
base.OnDragComplete (de);
}
Point _mouseDownPoint = Point.Empty;
internal override void OnMouseDown (int x, int y)
{
_mouseDownPoint.X = x;
_mouseDownPoint.Y = y;
base.OnMouseDown (x, y);
}
internal override void OnMouseUp ()
{
base.OnMouseUp ();
if (!this.Control.AllowDrop) // check MouseDragBegin for the reason of having this
this.Control.AllowDrop = true;
_mouseDownPoint = Point.Empty;
}
internal override void OnMouseMove (int x, int y)
{
IUISelectionService uiSelection = this.GetService (typeof (IUISelectionService)) as IUISelectionService;
if (uiSelection != null)
uiSelection.SetCursor (x, y);
base.OnMouseMove (x, y);
}
// Align the point to the grid
//
private Point SnapPointToGrid (Point location)
{
Rectangle gridSurface = this.Control.Bounds;
Size gridSize = (Size)GetValue (this.Component, "GridSize");
if ((bool)GetValue (this.Component, "SnapToGrid")) {
int x = location.X + (gridSize.Width - (location.X % gridSize.Width));
if (x > gridSurface.Width)
x = gridSurface.Width - gridSize.Width;
location.X = x;
int y = location.Y + (gridSize.Height - (location.Y % gridSize.Height));
if (y > gridSurface.Height)
y = gridSurface.Height - gridSize.Height;
location.Y = y;
}
return location;
}
#endregion
#region WndProc and Misc Message Handlers
protected override void OnSetCursor ()
{
if (this.Control != null) {
IToolboxService tbService = GetService (typeof (IToolboxService)) as IToolboxService;
if (tbService != null)
tbService.SetCursor ();
else
base.OnSetCursor ();
}
}
// Draws the design-time grid if DrawGrid == true
//
protected override void OnPaintAdornments (PaintEventArgs pe)
{
base.OnPaintAdornments (pe);
bool drawGrid;
Size gridSize;
// in case WM_PAINT is received before the IDesignerFilter is invoked to add
// those properties.
try {
drawGrid = (bool)GetValue (this.Component, "DrawGrid");
} catch {
drawGrid = this.DrawGrid;
}
try {
gridSize = (Size)GetValue (this.Component, "GridSize");
} catch {
gridSize = this.GridSize;
}
if (drawGrid) {
GraphicsState state = pe.Graphics.Save ();
pe.Graphics.TranslateTransform (this.Control.ClientRectangle.X,
this.Control.ClientRectangle.Y);
ControlPaint.DrawGrid (pe.Graphics, this.Control.ClientRectangle, gridSize, this.Control.BackColor);
pe.Graphics.Restore (state);
}
IUISelectionService selection = this.GetService (typeof (IUISelectionService)) as IUISelectionService;
if (selection != null)
selection.PaintAdornments (this.Control, pe.Graphics);
}
#endregion
protected Control GetControl (object component)
{
IComponent comp = component as IComponent;
if (comp != null && comp.Site != null) {
IDesignerHost host = comp.Site.GetService (typeof (IDesignerHost)) as IDesignerHost;
if (host != null) {
ControlDesigner designer = host.GetDesigner (comp) as ControlDesigner;
if (designer != null)
return designer.Control;
}
}
return null;
}
#region NET_2_0 Stubs
[MonoTODO]
protected virtual bool AllowControlLasso {
get { return false; }
}
[MonoTODO]
protected virtual bool AllowGenericDragBox {
get { return false; }
}
[MonoTODO]
protected internal virtual bool AllowSetChildIndexOnDrop {
get { return false; }
}
[MonoTODO]
public override IList SnapLines {
get { return new object [0]; }
}
[MonoTODO]
protected ToolboxItem MouseDragTool {
get { return null; }
}
[MonoTODO]
public override void InitializeNewComponent (IDictionary defaultValues)
{
base.InitializeNewComponent (defaultValues);
}
[MonoTODO]
protected void AddPaddingSnapLines (ref ArrayList snapLines)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected virtual Control GetParentForComponent (IComponent component)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected override ControlBodyGlyph GetControlGlyph (GlyphSelectionType selectionType)
{
return base.GetControlGlyph (selectionType);
}
[MonoTODO]
public override GlyphCollection GetGlyphs (GlyphSelectionType selectionType)
{
return base.GetGlyphs (selectionType);
}
[MonoTODO]
protected Rectangle GetUpdatedRect (Rectangle originalRect, Rectangle dragRect, bool updateSize)
{
throw new NotImplementedException ();
}
#endregion
}
}
| gpl-2.0 |
spencerfinnell/sacr | content-further-research.php | 1147 | <?php return; ?>
<section class="further divider before">
<div class="container">
<div class="span-two-thirds alignleft">
<h2 class="section-title">Further Research</h2>
<div class="row clearfix">
<div class="span-one-third alignleft">
<h3 class="sub-section">People</h3>
<?php
wp_nav_menu( array(
'theme_location' => 'people',
'menu_class' => 'research-list',
'depth' => 1
) );
?>
</div>
<div class="span-one-third alignleft">
<h3 class="sub-section">Places</h3>
<?php
wp_nav_menu( array(
'theme_location' => 'places',
'menu_class' => 'research-list',
'depth' => 1
) );
?>
</div>
<div class="span-one-third alignleft">
<h3 class="sub-section">Events</h3>
<?php
wp_nav_menu( array(
'theme_location' => 'events',
'menu_class' => 'research-list',
'depth' => 1
) );
?>
</div>
</div>
</div>
<div class="sponsors span-one-third alignright">
<h2 class="section-title">Flagler College...</h2>
</div>
</div>
</section><!-- .further --> | gpl-2.0 |
syoninfomedia/INSIV_SCRIPTS | wp-content/plugins/wp-email-template/wp-email-template.php | 2733 | <?php
/*
Plugin Name: WP Email Template LITE
Plugin URI: http://a3rev.com/shop/wp-email-template/
Description: This plugin automatically adds a professional, responsive, customizable, email browser optimized HTML template for all WordPress and WordPress plugin generated emails that are sent from your site to customers and admins. Works with any WordPress plugin including the e-commerce plugins WooCommerce and WP e-Commerce.
Version: 1.1.0
Author: A3 Revolution
Author URI: http://www.a3rev.com/
License: This software is under commercial license and copyright to A3 Revolution Software Development team
WP Email Template plugin
Copyright© 2011 A3 Revolution Software Development team
A3 Revolution Software Development team
admin@a3rev.com
PO Box 1170
Gympie 4570
QLD Australia
*/
?>
<?php
define('WP_EMAIL_TEMPLATE_FILE_PATH', dirname(__FILE__));
define('WP_EMAIL_TEMPLATE_DIR_NAME', basename(WP_EMAIL_TEMPLATE_FILE_PATH));
define('WP_EMAIL_TEMPLATE_FOLDER', dirname(plugin_basename(__FILE__)));
define('WP_EMAIL_TEMPLATE_URL', untrailingslashit( plugins_url( '/', __FILE__ ) ) );
define('WP_EMAIL_TEMPLATE_DIR', WP_CONTENT_DIR.'/plugins/'.WP_EMAIL_TEMPLATE_FOLDER);
define('WP_EMAIL_TEMPLATE_NAME', plugin_basename(__FILE__) );
define('WP_EMAIL_TEMPLATE_IMAGES_URL', WP_EMAIL_TEMPLATE_URL . '/assets/images' );
define('WP_EMAIL_TEMPLATE_JS_URL', WP_EMAIL_TEMPLATE_URL . '/assets/js' );
define('WP_EMAIL_TEMPLATE_CSS_URL', WP_EMAIL_TEMPLATE_URL . '/assets/css' );
if(!defined("WP_EMAIL_TEMPLATE_AUTHOR_URI"))
define("WP_EMAIL_TEMPLATE_AUTHOR_URI", "http://a3rev.com/shop/wp-email-template/");
if(!defined("WP_EMAIL_TEMPLATE_DOCS_URI"))
define("WP_EMAIL_TEMPLATE_DOCS_URI", "http://docs.a3rev.com/user-guides/plugins-extensions/wordpress/wp-email-template/");
include('admin/admin-ui.php');
include('admin/admin-interface.php');
include('admin/admin-pages/admin-email-template-page.php');
include('admin/admin-init.php');
include('classes/class-email-functions.php');
include('classes/class-email-hook.php');
include('admin/email-init.php');
/**
* Call when the plugin is activated and deactivated
*/
register_activation_hook(__FILE__,'wp_email_template_install');
function wp_email_template_lite_uninstall(){
if ( get_option('wp_email_template_lite_clean_on_deletion') == 1 ) {
delete_option( 'wp_email_template_general' );
delete_option( 'wp_email_template_style' );
delete_option( 'wp_email_template_social_media' );
delete_option( 'wp_email_template_email_footer' );
delete_option( 'wp_email_template_lite_clean_on_deletion' );
}
}
if ( get_option('wp_email_template_lite_clean_on_deletion') == 1 ) {
register_uninstall_hook( __FILE__, 'wp_email_template_lite_uninstall' );
}
?> | gpl-2.0 |
fittipaldi/com_polls | mod_polls/helper.php | 1378 | <?php
/**
* @package Joomla.Site
* @subpackage mod_banners
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_banners
*
* @package Joomla.Site
* @subpackage mod_banners
* @since 1.5
*/
class ModPollsHelper
{
/**
* Retrieve list of banners
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return mixed
*/
public static function &getPoll(&$params)
{
$poll_id = 1;
/** @var $db JDatabaseDriver */
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->qn('#__polls_items'));
$query->where('state = 1');
$query->where($db->qn('polls_item_id') . ' = ' . $poll_id);
$db->setQuery($query);
$poll = $db->loadObject();
if ($poll) {
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->qn('#__polls_answers'));
$query->where($db->qn('polls_item_id') . ' = ' . $poll_id);
$db->setQuery($query);
$poll->answers = $db->loadObjectList();
return $poll;
}
return null;
}
}
| gpl-2.0 |
DRNadler/DRN_TopHat | android/src/NativeI2CbaroListener.java | 1314 | /*
Copyright_License {
XCSoar Glide Computer - http://www.xcsoar.org/
Copyright (C) 2000-2013 The XCSoar Project
A detailed list of copyright holders can be found in the file "AUTHORS".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
*/
package org.tophat;
/**
* A #I2Cbaro.Listener implementation that passes method calls to
* native code.
*/
class NativeI2CbaroListener implements I2Cbaro.Listener {
/**
* A native pointer.
*/
private final long ptr;
NativeI2CbaroListener(long _ptr) {
ptr = _ptr;
}
@Override public native void onI2CbaroValues(int sensor, int pressure);
@Override public native void onI2CbaroError();
}
| gpl-2.0 |
johannes-mueller/ardour | gtk2_ardour/keyboard.cc | 11094 | /*
Copyright (C) 2001 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pbd/convert.h"
#include "pbd/error.h"
#include "pbd/file_utils.h"
#include "pbd/basename.h"
#include "ardour/filesystem_paths.h"
#include "ardour/revision.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "keyboard.h"
#include "opts.h"
#include "ui_config.h"
#include "pbd/i18n.h"
using namespace std;
using namespace Gtk;
using namespace PBD;
using namespace ARDOUR;
using Gtkmm2ext::Keyboard;
#ifdef __APPLE__
guint ArdourKeyboard::constraint_mod = Keyboard::PrimaryModifier;
#else
guint ArdourKeyboard::constraint_mod = Keyboard::TertiaryModifier;
#endif
/* TrimDrag::start_grab() */
guint ArdourKeyboard::trim_contents_mod = Keyboard::PrimaryModifier;
/* TrimDrag::motion() */
guint ArdourKeyboard::trim_overlap_mod = Keyboard::TertiaryModifier;
/* TrimDrag::start_grab() */
guint ArdourKeyboard::trim_anchored_mod = Keyboard::PrimaryModifier|Keyboard::TertiaryModifier;
/* ControlPointDrag::motion() && LineDrag::motion()*/
guint ArdourKeyboard::fine_adjust_mod = Keyboard::PrimaryModifier|Keyboard::SecondaryModifier; // XXX better just 2ndary
/* ControlPointDrag::start_grab() && MarkerDrag::motion() */
guint ArdourKeyboard::push_points_mod = Keyboard::PrimaryModifier|Keyboard::Level4Modifier;
/* NoteResizeDrag::start_grab() */
guint ArdourKeyboard::note_size_relative_mod = Keyboard::TertiaryModifier; // XXX better: 2ndary
ArdourKeyboard::ArdourKeyboard (ARDOUR_UI& ardour_ui) : ui (ardour_ui)
{
Keyboard::RelevantModifierKeysChanged.connect (sigc::mem_fun (*this, &ArdourKeyboard::reset_relevant_modifier_key_mask));
}
void
ArdourKeyboard::find_bindings_files (map<string,string>& files)
{
vector<std::string> found;
Searchpath spath = ardour_config_search_path();
find_files_matching_pattern (found, spath, string_compose ("*%1", Keyboard::binding_filename_suffix));
if (found.empty()) {
return;
}
for (vector<std::string>::iterator x = found.begin(); x != found.end(); ++x) {
std::string path(*x);
pair<string,string> namepath;
namepath.second = path;
namepath.first = PBD::basename_nosuffix (path);
files.insert (namepath);
}
}
void
ArdourKeyboard::setup_keybindings ()
{
string keybindings_path = ARDOUR_COMMAND_LINE::keybindings_path;
string default_bindings = string_compose ("%1%2", UIConfiguration::instance().get_default_bindings(), Keyboard::binding_filename_suffix);
vector<string> strs;
binding_files.clear ();
find_bindings_files (binding_files);
/* set up the per-user bindings path */
string lowercase_program_name = downcase (string(PROGRAM_NAME));
/* extract and append minor vesion */
std::string rev (revision);
std::size_t pos = rev.find_first_of("-");
if (pos != string::npos && pos > 0) {
lowercase_program_name += "-";
lowercase_program_name += rev.substr (0, pos);
}
user_keybindings_path = Glib::build_filename (user_config_directory(), lowercase_program_name + binding_filename_suffix);
if (Glib::file_test (user_keybindings_path, Glib::FILE_TEST_EXISTS)) {
std::pair<string,string> newpair;
newpair.first = _("your own");
newpair.second = user_keybindings_path;
binding_files.insert (newpair);
}
/* check to see if they gave a style name ("ergonomic") or an actual filename (*.bindings)
*/
if (!keybindings_path.empty() && keybindings_path.find (binding_filename_suffix) == string::npos) {
// just a style name - allow user to
// specify the layout type.
char* layout;
if ((layout = getenv ("ARDOUR_KEYBOARD_LAYOUT")) != 0 && layout[0] != '\0') {
/* user-specified keyboard layout */
keybindings_path += '-';
keybindings_path += layout;
} else {
/* default to US/ANSI - we have to pick something */
keybindings_path += "-us";
}
keybindings_path += binding_filename_suffix;
}
if (keybindings_path.empty()) {
/* no path or binding name given: check the user one first */
if (!Glib::file_test (user_keybindings_path, Glib::FILE_TEST_EXISTS)) {
keybindings_path = "";
} else {
keybindings_path = user_keybindings_path;
}
}
/* if we still don't have a path at this point, use the default */
if (keybindings_path.empty()) {
keybindings_path = default_bindings;
}
while (true) {
if (!Glib::path_is_absolute (keybindings_path)) {
/* not absolute - look in the usual places */
std::string keybindings_file;
if (!find_file (ardour_config_search_path(), keybindings_path, keybindings_file)) {
if (keybindings_path == default_bindings) {
error << string_compose (_("Default keybindings not found - %1 will be hard to use!"), PROGRAM_NAME) << endmsg;
return;
} else {
warning << string_compose (_("Key bindings file \"%1\" not found. Default bindings used instead"),
keybindings_path)
<< endmsg;
keybindings_path = default_bindings;
}
} else {
/* use it */
keybindings_path = keybindings_file;
break;
}
} else {
/* path is absolute already */
if (!Glib::file_test (keybindings_path, Glib::FILE_TEST_EXISTS)) {
if (keybindings_path == default_bindings) {
error << string_compose (_("Default keybindings not found - %1 will be hard to use!"), PROGRAM_NAME) << endmsg;
return;
} else {
keybindings_path = default_bindings;
}
} else {
break;
}
}
}
load_keybindings (keybindings_path);
/* catch changes made via some GTK mechanism */
// GtkAccelMap* accelmap = gtk_accel_map_get();
// g_signal_connect (accelmap, "changed", (GCallback) accel_map_changed, this);
}
XMLNode&
ArdourKeyboard::get_state (void)
{
XMLNode* node = &Keyboard::get_state ();
node->set_property ("constraint-modifier", constraint_mod);
node->set_property ("trim-contents-modifier", trim_contents_mod);
node->set_property ("trim-overlap-modifier", trim_overlap_mod);
node->set_property ("trim-anchored-modifier", trim_anchored_mod);
node->set_property ("fine-adjust-modifier", fine_adjust_mod);
node->set_property ("push-points-modifier", push_points_mod);
node->set_property ("note-size-relative-modifier", note_size_relative_mod);
return *node;
}
int
ArdourKeyboard::set_state (const XMLNode& node, int version)
{
node.get_property ("constraint-modifier", constraint_mod);
node.get_property ("trim-contents-modifier", trim_contents_mod);
node.get_property ("trim-overlap-modifier", trim_overlap_mod);
node.get_property ("trim-anchored-modifier", trim_anchored_mod);
node.get_property ("fine-adjust-modifier", fine_adjust_mod);
node.get_property ("push-points-modifier", push_points_mod);
node.get_property ("note-size-relative-modifier", note_size_relative_mod);
return Keyboard::set_state (node, version);
}
void
ArdourKeyboard::reset_relevant_modifier_key_mask ()
{
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | constraint_mod);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | trim_contents_mod);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | trim_overlap_mod);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | trim_anchored_mod);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | fine_adjust_mod);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | push_points_mod);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | note_size_relative_mod);
}
/* Snap and snap delta modifiers may contain each other, so we use the
* following two methods to sort that out:
*/
bool
ArdourKeyboard::indicates_snap (guint state)
{
const bool contains_s = Keyboard::modifier_state_contains (state, Keyboard::snap_modifier ());
const bool contains_d = Keyboard::modifier_state_contains (state, Keyboard::snap_delta_modifier ());
const bool s_contains_d = Keyboard::modifier_state_contains (Keyboard::snap_modifier (), Keyboard::snap_delta_modifier ());
return (contains_s && ((contains_d && s_contains_d) || !contains_d));
}
bool
ArdourKeyboard::indicates_snap_delta (guint state)
{
const bool contains_d = Keyboard::modifier_state_contains (state, Keyboard::snap_delta_modifier ());
const bool contains_s = Keyboard::modifier_state_contains (state, Keyboard::snap_modifier ());
const bool d_contains_s = Keyboard::modifier_state_contains (Keyboard::snap_delta_modifier (), Keyboard::snap_modifier ());
return (contains_d && ((contains_s && d_contains_s) || !contains_s));
}
/* Constraint and copy modifiers are both in effect at the beginning of some drags, and may be set ambiguously */
bool
ArdourKeyboard::indicates_copy (guint state)
{
const bool contains_c = Keyboard::modifier_state_contains (state, Keyboard::CopyModifier);
const bool equals_cs = Keyboard::modifier_state_equals (state, constraint_modifier ());
return contains_c && !equals_cs;
}
bool
ArdourKeyboard::indicates_constraint (guint state)
{
const bool contains_cs = Keyboard::modifier_state_contains (state, constraint_modifier ());
const bool equals_c = Keyboard::modifier_state_equals (state, Keyboard::CopyModifier);
return contains_cs && !equals_c;
}
void
ArdourKeyboard::set_constraint_modifier (guint mod)
{
constraint_mod = mod;
the_keyboard().reset_relevant_modifier_key_mask();
}
void
ArdourKeyboard::set_trim_contents_modifier (guint mod)
{
trim_contents_mod = mod;
the_keyboard().reset_relevant_modifier_key_mask();
}
void
ArdourKeyboard::set_trim_overlap_modifier (guint mod)
{
trim_overlap_mod = mod;
the_keyboard().reset_relevant_modifier_key_mask();
}
void
ArdourKeyboard::set_trim_anchored_modifier (guint mod)
{
trim_anchored_mod = mod;
the_keyboard().reset_relevant_modifier_key_mask();
}
void
ArdourKeyboard::set_fine_adjust_modifier (guint mod)
{
fine_adjust_mod = mod;
the_keyboard().reset_relevant_modifier_key_mask();
}
void
ArdourKeyboard::set_push_points_modifier (guint mod)
{
push_points_mod = mod;
the_keyboard().reset_relevant_modifier_key_mask();
}
void
ArdourKeyboard::set_note_size_relative_modifier (guint mod)
{
note_size_relative_mod = mod;
the_keyboard().reset_relevant_modifier_key_mask();
}
Selection::Operation
ArdourKeyboard::selection_type (guint state)
{
/* note that there is no modifier for "Add" */
if (modifier_state_equals (state, RangeSelectModifier)) {
return Selection::Extend;
} else if (modifier_state_equals (state, PrimaryModifier)) {
return Selection::Toggle;
} else {
return Selection::Set;
}
}
| gpl-2.0 |
papillon-cendre/d8 | vendor/symfony/http-kernel/EventListener/LocaleListener.php | 3530 | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Routing\RequestContextAwareInterface;
/**
* Initializes the locale based on the current request.
*
* This listener works in 2 modes:
*
* * 2.3 compatibility mode where you must call setRequest whenever the Request changes.
* * 2.4+ mode where you must pass a RequestStack instance in the constructor.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class LocaleListener implements EventSubscriberInterface
{
private $router;
private $defaultLocale;
private $requestStack;
/**
* RequestStack will become required in 3.0.
*/
public function __construct($defaultLocale = 'en', RequestContextAwareInterface $router = null, RequestStack $requestStack = null)
{
$this->defaultLocale = $defaultLocale;
$this->requestStack = $requestStack;
$this->router = $router;
}
/**
* Sets the current Request.
*
* This method was used to synchronize the Request, but as the HttpKernel
* is doing that automatically now, you should never call it directly.
* It is kept public for BC with the 2.3 version.
*
* @param Request|null $request A Request instance
*
* @deprecated since version 2.4, to be removed in 3.0.
*/
public function setRequest(Request $request = null)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
if (null === $request) {
return;
}
$this->setLocale($request);
$this->setRouterContext($request);
}
public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
$request->setDefaultLocale($this->defaultLocale);
$this->setLocale($request);
$this->setRouterContext($request);
}
public function onKernelFinishRequest(FinishRequestEvent $event)
{
if (null === $this->requestStack) {
return; // removed when requestStack is required
}
if (null !== $parentRequest = $this->requestStack->getParentRequest()) {
$this->setRouterContext($parentRequest);
}
}
private function setLocale(Request $request)
{
if ($locale = $request->attributes->get('_locale')) {
$request->setLocale($locale);
}
}
private function setRouterContext(Request $request)
{
if (null !== $this->router) {
$this->router->getContext()->setParameter('_locale', $request->getLocale());
}
}
public static function getSubscribedEvents()
{
return array(
// must be registered after the Router to have access to the _locale
KernelEvents::REQUEST => array(array('onKernelRequest', 16)),
KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)),
);
}
}
| gpl-2.0 |
apicescn/xxl-job | xxl-job-core/src/main/java/com/xxl/job/core/util/JacksonUtil.java | 2369 | package com.xxl.job.core.util;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Jackson util
*
* 1、obj need private and set/get;
* 2、do not support inner class;
*
* @author xuxueli 2015-9-25 18:02:56
*/
public class JacksonUtil {
private final static ObjectMapper objectMapper = new ObjectMapper();
public static ObjectMapper getInstance() {
return objectMapper;
}
/**
* bean、array、List、Map --> json
*
* @param obj
* @return json string
* @throws Exception
*/
public static String writeValueAsString(Object obj) {
try {
return getInstance().writeValueAsString(obj);
} catch (JsonGenerationException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* string --> bean、Map、List(array)
*
* @param jsonStr
* @param clazz
* @return obj
* @throws Exception
*/
public static <T> T readValue(String jsonStr, Class<T> clazz) {
try {
return getInstance().readValue(jsonStr, clazz);
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static <T> T readValueRefer(String jsonStr, Class<T> clazz) {
try {
return getInstance().readValue(jsonStr, new TypeReference<T>() { });
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static void main(String[] args) {
try {
Map<String, String> map = new HashMap<String, String>();
map.put("aaa", "111");
map.put("bbb", "222");
String json = writeValueAsString(map);
System.out.println(json);
System.out.println(readValue(json, Map.class));
} catch (Exception e) {
e.printStackTrace();
}
}
}
| gpl-2.0 |
anton-troshin/clematis.desktop | libs/kiwi/src/main/java/com/hyperrealm/kiwi/ui/LocaleChooser.java | 3304 | /* ----------------------------------------------------------------------------
The Kiwi Toolkit - A Java Class Library
Copyright (C) 1998-2008 Mark A. Lindner
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; if not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
*/
package com.hyperrealm.kiwi.ui;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import com.hyperrealm.kiwi.util.StringUtils;
/** This class represents a combo box for selecting a locale. Locales may be
* presented in their own specific localized form (the default), or in the
* current locale.
*
* <p><center>
* <img src="snapshot/LocaleChooser.gif"><br>
* <i>An example LocaleChooser.</i>
* </center>
* <p>
*
* @author Mark Lindner
*/
public class LocaleChooser extends JComboBox
{
private ArrayList<Locale> supportedLocales = new ArrayList<Locale>();
/** Construct a new <code>LocaleChooser</code>.
*
* @param locales The list of locales to display.
* @since Kiwi 2.1
*/
public LocaleChooser(Locale locales[])
{
this(locales, true);
}
/** Construct a new <code>LocaleChooser</code>.
*
* @param locales The list of locales to display.
* @param localizeDisplay If <b>true</b>, each locale entry is
* localized to itself. Otherwise, all entries are displayed in the current
* locale.
* @since Kiwi 2.1
*/
public LocaleChooser(Locale locales[], boolean localizeDisplay)
{
for(int i = 0; i < locales.length; i++)
{
String country = (localizeDisplay ? locales[i].getDisplayCountry()
: locales[i].getCountry());
String variant = (localizeDisplay ? locales[i].getDisplayVariant()
: locales[i].getVariant());
String name = (localizeDisplay ? locales[i].getDisplayName(locales[i])
: locales[i].getDisplayName());
supportedLocales.add(locales[i]);
String item = StringUtils.uppercaseFirst(name);
if(country != null)
name += " (" + country + ")";
addItem(item);
}
}
/** Get the currently selected locale.
*
* @return A <code>Locale</code> object corresponding to the currently-
* selected locale, or <code>null</code> if there is no selection.
*/
public Locale getSelectedLocale()
{
int x = getSelectedIndex();
if(x < 0)
return(null);
return(supportedLocales.get(x));
}
/** Set the currently selected locale.
*
* @param locale The locale.
* @since Kiwi 2.1
*/
public void setSelectedLocale(Locale locale)
{
int index = supportedLocales.indexOf(locale);
setSelectedIndex(index);
}
}
/* end of source file */
| gpl-2.0 |
alexey-lysiuk/beye | src/fileutil.cpp | 36996 | #include "config.h"
#include "libbeye/libbeye.h"
using namespace usr;
/**
* @namespace usr
* @file fileutil.c
* @brief This file contains file utilities of BEYE project.
* @version -
* @remark this source file is part of Binary EYE project (BEYE).
* The Binary EYE (BEYE) is copyright (C) 1995 Nickols_K.
* All rights reserved. This software is redistributable under the
* licence given in the file "Licence.en" ("Licence.ru" in russian
* translation) distributed in the BEYE archive.
* @note Requires POSIX compatible development system
*
* @author Nickols_K
* @since 1995
* @note Development, fixes and improvements
**/
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <fstream>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <errno.h>
#include <ctype.h>
#include "beye.h"
#include "editor.h"
#include "tstrings.h"
#include "plugins/hexmode.h"
#include "plugins/disasm.h"
#include "beyeutil.h"
#include "bconsole.h"
#include "listbox.h"
#include "libbeye/bbio.h"
#include "libbeye/bswap.h"
#include "libbeye/twindow.h"
#include "libbeye/kbd_code.h"
#include "libbeye/osdep/tconsole.h"
#include "libbeye/osdep/system.h"
namespace usr {
extern const Plugin_Info disMode;
class FileUtilities : public Opaque {
public:
FileUtilities(BeyeContext&);
virtual ~FileUtilities();
virtual bool run() = 0;
protected:
__filesize_t ff_startpos,ff_len;
BeyeContext& bctx;
};
class ChSize : public FileUtilities {
public:
ChSize(BeyeContext&);
virtual ~ChSize();
virtual bool run();
static FileUtilities* query_interface(BeyeContext&);
};
FileUtilities::FileUtilities(BeyeContext& b):bctx(b) {}
FileUtilities::~FileUtilities() {}
ChSize::ChSize(BeyeContext& b):FileUtilities(b) {}
ChSize::~ChSize() {}
bool ChSize::run()
{
__fileoff_t psize,tile = 0;
if(Get16DigitDlg(" Change size of file ","Num. of bytes (+-dec):",3,(unsigned long long*)&tile)) {
if(tile == 0) { bctx.ErrMessageBox("Invalid new length",""); return false; }
psize = bctx.flength();
psize += tile;
if(psize > 0) {
bool ret;
int my_errno = 0;
std::string fname = bctx.bm_file().filename();
binary_stream* bHandle;
bHandle = BeyeContext::beyeOpenRW(fname,BBIO_SMALL_CACHE_SIZE);
if(bHandle == NULL) {
err:
bctx.errnoMessageBox(RESIZE_FAIL,"",my_errno);
return false;
}
ret = bHandle->chsize(psize);
my_errno = errno;
delete bHandle;
if(ret == false) goto err;
bctx.bm_file().reread();
return ret;
}
}
return false;
}
FileUtilities* ChSize::query_interface(BeyeContext& b) { return new(zeromem) ChSize(b); }
class InsDelBlock : public FileUtilities {
public:
InsDelBlock(BeyeContext&);
virtual ~InsDelBlock();
virtual bool run();
static FileUtilities* query_interface(BeyeContext&);
private:
bool InsBlock(binary_stream* bHandle,__filesize_t start,__fileoff_t psize) const;
bool DelBlock(binary_stream* bHandle,__filesize_t start,__fileoff_t psize) const;
};
InsDelBlock::InsDelBlock(BeyeContext& b):FileUtilities(b) {}
InsDelBlock::~InsDelBlock() {}
bool InsDelBlock::InsBlock(binary_stream* bHandle,__filesize_t start,__fileoff_t psize) const
{
__filesize_t tile,oflen,flen,crpos,cwpos;
unsigned numtowrite;
oflen = bHandle->flength();
flen = oflen + psize;
tile = oflen - start;
if(!bHandle->chsize(oflen+psize)) {
bctx.ErrMessageBox(EXPAND_FAIL,"");
return false;
}
crpos = oflen-std::min(tile,__filesize_t(51200U));
cwpos = flen-std::min(tile,__filesize_t(51200U));
numtowrite = (unsigned)std::min(tile,__filesize_t(51200U));
while(tile) {
bHandle->seek(crpos,binary_stream::Seek_Set);
binary_packet bp=bHandle->read(numtowrite);
bHandle->seek(cwpos,binary_stream::Seek_Set);
bHandle->write(bp);
tile -= numtowrite;
numtowrite = (unsigned)std::min(tile,__filesize_t(51200U));
crpos -= numtowrite;
cwpos -= numtowrite;
}
tile = oflen - start;
cwpos = start;
binary_packet wbp(51200U);
memset(wbp.data(),0,51200U);
while(psize) {
numtowrite = (unsigned)std::min(psize,__fileoff_t(51200U));
if(numtowrite!=51200U) wbp.resize(numtowrite);
bHandle->seek(cwpos,binary_stream::Seek_Set);
bHandle->write(wbp);
psize -= numtowrite;
cwpos += numtowrite;
}
return true;
}
bool InsDelBlock::DelBlock(binary_stream* bHandle,__filesize_t start,__fileoff_t psize) const
{
__filesize_t tile,oflen,crpos,cwpos;
unsigned numtowrite;
oflen = bHandle->flength();
tile = oflen - start;
crpos = start-psize; /** psize is negative value */
cwpos = start;
while(tile) {
numtowrite = (unsigned)std::min(tile,__filesize_t(51200U));
bHandle->seek(crpos,binary_stream::Seek_Set);
binary_packet bp=bHandle->read(numtowrite);
bHandle->seek(cwpos,binary_stream::Seek_Set);
bHandle->write(bp);
tile -= numtowrite;
crpos += numtowrite;
cwpos += numtowrite;
}
if(!bHandle->chsize(oflen+psize)) bctx.ErrMessageBox(TRUNC_FAIL,"");
return true;
}
bool InsDelBlock::run()
{
__filesize_t start;
static __fileoff_t psize;
bool ret = false;
start = bctx.tell();
if(GetInsDelBlkDlg(" Insert or delete block to/from file ",&start,&psize)) {
__filesize_t fpos;
binary_stream* bHandle;
std::string fname;
fpos = bctx.tell();
if(start > bctx.flength()) { bctx.ErrMessageBox("Start is outside of file",""); return 0; }
if(!psize) return 0;
if(psize < 0) if(start+labs(psize) > bctx.flength()) { bctx.ErrMessageBox("Use change size operation instead of block deletion",""); return 0; }
fname = bctx.bm_file().filename();
bHandle = BeyeContext::beyeOpenRW(fname,BBIO_SMALL_CACHE_SIZE);
if(bHandle == NULL) bctx.errnoMessageBox(OPEN_FAIL,"",errno);
else {
if(psize < 0) ret = DelBlock(bHandle,start,psize);
else ret = InsBlock(bHandle,start,psize);
delete bHandle;
bctx.bm_file().reread();
}
bctx.bm_file().seek(fpos,binary_stream::Seek_Set);
}
return ret;
}
FileUtilities* InsDelBlock::query_interface(BeyeContext& b) { return new(zeromem) InsDelBlock(b); }
class FStore : public FileUtilities {
public:
FStore(BeyeContext&);
virtual ~FStore();
virtual bool run();
static FileUtilities* query_interface(BeyeContext&);
protected:
virtual void __make_dump_name(const std::string& end);
std::string ff_fname;
private:
void printObject(std::ofstream& fout,const Object_Info& obj) const;
void printHdr(std::ofstream& fout,const Bin_Format& fmt) const;
std::string GET_FUNC_CLASS(Symbol_Info::symbol_class x) const { return x == Symbol_Info::Local ? "private" : "public"; }
std::string make_addr_column(__filesize_t offset) const;
unsigned printHelpComment(std::ostringstream& os,MBuffer codebuff,DisasmRet *dret,DisMode::e_severity dis_severity,const std::string& dis_comments) const;
};
FStore::FStore(BeyeContext& b):FileUtilities(b),ff_fname("beye.$$$") {}
FStore::~FStore() {}
void FStore::printObject(std::ofstream& fout,const Object_Info& obj) const
{
const char *btn;
std::string name;
switch(obj.bitness) {
case Bin_Format::Use16: btn = "USE16"; break;
case Bin_Format::Use32: btn = "USE32"; break;
case Bin_Format::Use64: btn = "USE64"; break;
case Bin_Format::Use128:btn = "USE128"; break;
case Bin_Format::Use256:btn = "USE256"; break;
default: btn = "";
}
name = !obj.name.empty() ? obj.name : obj._class == Object_Info::Data ? "DUMP_DATA" :
obj._class == Object_Info::Code ? "DUMP_TEXT" :
"Unknown";
if(obj.name.empty()) { std::ostringstream os; os<<name<<obj.number; name = os.str(); }
fout<<std::endl<<"SEGMENT "<<name<<" BYTE PUBLIC "<<btn<<" '"<<(obj._class == Object_Info::Data ? "DATA" : obj._class == Object_Info::Code ? "CODE" : "NoObject")<<"'"<<std::endl;
fout<<"; size: "<<std::dec<<(obj.end-obj.start)<<" bytes"<<std::endl<<std::endl;
}
void FStore::printHdr(std::ofstream& fout,const Bin_Format& fmt) const
{
const char *cptr,*cptr1,*cptr2;
time_t tim;
cptr = cptr1 = ";"; cptr2 = "";
time(&tim);
fout<<cptr1<<std::endl;
fout<<cptr<<"Disassembler dump of \'"<<bctx.bm_file().filename()<<"\'"<<std::endl;
fout<<cptr<<"Range : "<<std::hex<<ff_startpos<<"H-"<<std::hex<<(ff_startpos+ff_len)<<"H"<<std::endl;
fout<<cptr<<"Written by "<<BEYE_VER_MSG<<std::endl;
fout<<cptr<<"Dumped : "<<ctime(&tim)<<std::endl;
fout<<cptr<<"Format : "<<fmt.name()<<std::endl;
fout<<cptr2<<std::endl<<std::endl;
}
unsigned FStore::printHelpComment(std::ostringstream& os,MBuffer codebuff,DisasmRet *dret,DisMode::e_severity dis_severity,const std::string& dis_comments) const
{
unsigned j;
if(dis_severity > DisMode::CommSev_None) {
os<<dis_comments;
os<<" ; ";
};
for(j = 0;j < dret->codelen;j++) os<<std::hex<<std::setfill('0')<<std::setw(2)<<unsigned(codebuff[j]);
return os.str().length();
}
std::string FStore::make_addr_column(__filesize_t offset) const
{
std::string buff;
if(hexAddressResolv) buff=bctx.bin_format().address_resolving(offset);
else {
buff="L";
buff+=Get8Digit(offset).c_str();
}
buff+=":";
return buff;
}
void FStore::__make_dump_name(const std::string& end)
{
/* construct name */
ff_fname=bctx.bm_file().filename();
ff_fname=ff_fname.substr(0,ff_fname.rfind('.'));
ff_fname+=end;
}
bool FStore::run()
{
unsigned long flags;
char *tmp_buff;
__filesize_t endpos,cpos;
binary_packet bp(1);
std::ostringstream dos;
tmp_buff = new char [0x1000];
flags = FSDLG_USEMODES | FSDLG_BINMODE | FSDLG_COMMENT;
DumpMode = true;
ff_startpos = bctx.tell();
if(!ff_len) ff_len = bctx.flength() - ff_startpos;
__make_dump_name(".$$$");
char ffname[4096];
strcpy(ffname,ff_fname.c_str());
if(GetFStoreDlg(" Save information to file ",ffname,&flags,&ff_startpos,&ff_len,FILE_PRMT)) {
ff_fname=ffname;
endpos = ff_startpos + ff_len;
endpos = endpos > bctx.flength() ? bctx.flength() : endpos;
if(endpos > ff_startpos) {
TWindow *progress_wnd;
unsigned prcnt_counter,oprcnt_counter;
cpos = bctx.tell();
progress_wnd = PercentWnd("Saving ..."," Save block to file ");
if(!(flags & FSDLG_ASMMODE)) { /** Write in binary mode */
std::ofstream fs;
__filesize_t wsize,crpos,pwsize,awsize;
unsigned rem;
wsize = endpos - ff_startpos;
fs.open(ff_fname.c_str(),std::ios_base::out|std::ios_base::binary);
if(!fs.good()) {
bctx.errnoMessageBox("Can't use file","",errno);
goto Exit;
}
crpos = ff_startpos;
fs.seekp(0L,std::ios_base::beg);
prcnt_counter = oprcnt_counter = 0;
pwsize = 0;
awsize = wsize;
while(wsize) {
unsigned real_size;
rem = (unsigned)std::min(wsize,__filesize_t(4096));
bctx.bm_file().seek(crpos,binary_stream::Seek_Set);
bp=bctx.bm_file().read(rem); memcpy(tmp_buff,bp.data(),bp.size());
if(bp.size()!=rem) {
bctx.errnoMessageBox(READ_FAIL,"",errno);
goto Exit;
}
real_size = (bctx.active_mode().flags()&Plugin::Has_ConvertCP) ? bctx.active_mode().convert_cp((char *)tmp_buff,rem,true) : rem;
fs.write(tmp_buff,real_size);
if(!fs.good()) {
bctx.errnoMessageBox(WRITE_FAIL,"",errno);
goto Exit;
}
wsize -= rem;
crpos += rem;
pwsize += rem;
prcnt_counter = (unsigned)((pwsize*100)/awsize);
if(prcnt_counter != oprcnt_counter) {
oprcnt_counter = prcnt_counter;
if(!ShowPercentInWnd(progress_wnd,prcnt_counter)) break;
}
}
} else { /** Write in disassembler mode */
std::ofstream fout;
unsigned char *codebuff;
unsigned MaxInsnLen;
std::ostringstream ddos;
__filesize_t stop;
Symbol_Info psym;
__filesize_t awsize,pwsize;
bool has_string;
Object_Info obj;
extern const Plugin_Info disMode;
DisMode* dismode;
if(bctx.mode_info()!=&disMode)
dismode = static_cast<DisMode*>(disMode.query_interface(bctx,bctx.bin_format(),bctx.bm_file(),bctx.main_wnd(),bctx.codeguider(),bctx._udn(),bctx.search()));
else
dismode = static_cast<DisMode*>(&bctx.active_mode());
unsigned disasm_type = dismode->query_type();
MaxInsnLen = dismode->get_max_symbol_size();
codebuff = new unsigned char [MaxInsnLen];
fout.open(ff_fname.c_str(),std::ios_base::out);
if(!fout.is_open()) {
bctx.errnoMessageBox(WRITE_FAIL,"",errno);
delete codebuff;
goto Exit;
}
if(flags & FSDLG_COMMENT) {
printHdr(fout,bctx.bin_format());
}
if(flags & FSDLG_STRUCTS) obj = bctx.bin_format().get_object_attribute(ff_startpos);
#if 0
if(!obj.number) goto defobj;
else {
defobj:
obj.number = 0;
obj.start = 0;
obj.end = bctx.flength();
obj.name[0] = 0;
obj._class = Object_Info::Code;
obj.bitness = bctx.bin_format().query_bitness(ff_startpos);
}
#endif
if(flags & FSDLG_STRUCTS) printObject(fout,obj);
psym.pa = Plugin::Bad_Address;
if(flags & FSDLG_STRUCTS) {
psym = bctx.bin_format().get_public_symbol(ff_startpos,true);
if(psym.pa!=Plugin::Bad_Address) {
fout<<GET_FUNC_CLASS(psym._class)<<" "<<psym.name<<":"<<std::endl;
if(psym.pa < ff_startpos && flags & FSDLG_COMMENT) {
fout<<"; ..."<<std::endl;
}
}
psym = bctx.bin_format().get_public_symbol(ff_startpos,false);
}
prcnt_counter = oprcnt_counter = 0;
awsize = endpos - ff_startpos;
pwsize = 0;
has_string = false;
while(1) {
DisasmRet dret;
int len;
if(flags & FSDLG_STRUCTS) {
if(ff_startpos >= obj.end) {
obj = bctx.bin_format().get_object_attribute(ff_startpos);
printObject(fout,obj);
}
if(obj._class == Object_Info::NoObject) {
__filesize_t diff;
fout<<"; L"<<std::hex<<std::setfill('0')<<std::setw(16)<<obj.start<<"H-L"<<std::hex<<std::setfill('0')<<std::setw(16)<<obj.end<<"H - no object"<<std::endl;
dret.codelen = std::min(__filesize_t(UCHAR_MAX),obj.end - ff_startpos);
/** some functions can placed in virtual area of objects
mean at end of true data, but before next object */
while(psym.pa!=Plugin::Bad_Address && psym.pa >= obj.start && psym.pa < obj.end && psym.pa > ff_startpos) {
diff = psym.pa - ff_startpos;
if(diff) fout<<"resb "<<std::dec<<diff<<"H"<<std::endl;
fout<<GET_FUNC_CLASS(psym._class)<<" "<<psym.name<<": ;at offset - "<<std::hex<<psym.pa<<"H"<<std::endl;
ff_startpos = psym.pa;
psym = bctx.bin_format().get_public_symbol(ff_startpos,false);
if(psym.pa==ff_startpos) {
fout<<"...Probably internal error of beye..."<<std::endl;
break;
}
}
diff = obj.end - ff_startpos;
if(diff) fout<<"resb "<<std::hex<<diff<<"H"<<std::endl;
ff_startpos = obj.end;
goto next_obj;
}
if(psym.pa!=Plugin::Bad_Address) {
int not_silly;
not_silly = 0;
while(ff_startpos == psym.pa) {
/* print out here all public labels */
fout<<GET_FUNC_CLASS(psym._class)<<" "<<psym.name<<std::endl;
psym = bctx.bin_format().get_public_symbol(ff_startpos,false);
not_silly++;
if(not_silly > 100) {
fout<<"; [snipped out] ..."<<std::endl;
break;
}
}
}
}
memset(codebuff,0,MaxInsnLen);
bctx.bm_file().seek(ff_startpos,binary_stream::Seek_Set);
bp=bctx.bm_file().read(MaxInsnLen); memcpy(codebuff,bp.data(),bp.size());
if(obj._class == Object_Info::Code||disasm_type==DISASM_DATA) dret = dismode->disassembler(ff_startpos,codebuff,__DISF_NORMAL);
else { /** Data object */
unsigned dis_data_len,ifreq,data_len;
char coll_str[__TVIO_MAXSCREENWIDTH];
size_t cstr_idx = 0;
dis_data_len = std::min(sizeof(coll_str)-1,size_t(MaxInsnLen));
for(cstr_idx = 0;cstr_idx < dis_data_len;cstr_idx++) {
if(isprint(codebuff[cstr_idx])) {
coll_str[cstr_idx] = codebuff[cstr_idx];
} else break;
}
coll_str[cstr_idx] = 0;
switch(obj.bitness) {
case Bin_Format::Use16: dis_data_len = 2; break;
case Bin_Format::Use32: dis_data_len = 4; break;
case Bin_Format::Use64: dis_data_len = 8; break;
case Bin_Format::Use128: dis_data_len = 16; break;
case Bin_Format::Use256: dis_data_len = 32; break;
default: dis_data_len = 1; break;
}
data_len = 0;
ddos.str("");
ddos<<"db ";
if(cstr_idx > 1) {
ddos<<"'"<<coll_str<<"'";
dret.codelen = cstr_idx;
has_string = true;
} else {
for(ifreq = 0;ifreq < dis_data_len;ifreq++) {
if(isprint(codebuff[ifreq]) && isprint(codebuff[ifreq+1])) break;
if(isprint(codebuff[ifreq]) && has_string) ddos<<"'"<<codebuff[ifreq]<<"',";
else ddos<<std::hex<<std::setfill('0')<<std::setw(2)<<unsigned(codebuff[ifreq])<<"h,";
data_len++;
has_string = false;
}
dret.codelen = data_len;
}
dret.str = ddos.str();
dret.pro_clone = 0;
dismode->dis_severity = DisMode::CommSev_None;
}
stop = psym.pa!=Plugin::Bad_Address ? std::min(psym.pa,obj.end) : obj.end;
dos.str("");
dos<<make_addr_column(ff_startpos);
if(flags & FSDLG_STRUCTS) {
if(stop && stop > ff_startpos && ff_startpos + dret.codelen > stop) {
unsigned lim,ii;
dos<<" db ";
lim = (unsigned)(stop-ff_startpos);
if(lim > MaxInsnLen) lim = MaxInsnLen;
for(ii = 0;ii < lim;ii++) dos<<std::hex<<std::setfill('0')<<std::setw(2)<<unsigned(codebuff[ii])<<" ";
dret.codelen = lim;
} else goto normline;
} else {
normline:
dos<<" "<<dret.str;
}
len = dos.str().length();
if(flags & FSDLG_COMMENT) {
if(len < 48) {
std::string t;
t.insert(0,48-len,' ');
len = 48;
dos<<t;
}
dos<<"; ";
len += 2;
len += printHelpComment(dos,codebuff,&dret,dismode->dis_severity,dismode->dis_comments);
}
fout<<szSpace2Tab(dos.str())<<std::endl;
if(!fout.good()) {
bctx.errnoMessageBox(WRITE_FAIL,"",errno);
goto dis_exit;
}
if(flags & FSDLG_STRUCTS) {
if(stop && ff_startpos != stop && ff_startpos + dret.codelen > stop)
dret.codelen = stop - ff_startpos;
}
if(!dret.codelen) {
bctx.ErrMessageBox("Internal fatal error"," Put structures ");
goto dis_exit;
}
ff_startpos += dret.codelen;
next_obj:
if(ff_startpos >= endpos) break;
pwsize += dret.codelen;
prcnt_counter = (unsigned)((pwsize*100)/awsize);
if(prcnt_counter != oprcnt_counter) {
oprcnt_counter = prcnt_counter;
if(!ShowPercentInWnd(progress_wnd,prcnt_counter)) break;
}
}
dis_exit:
delete codebuff;
fout.close();
if(bctx.mode_info()!=&disMode) delete dismode;
} /** END: Write in disassembler mode */
Exit:
delete progress_wnd;
bctx.bm_file().seek(cpos,binary_stream::Seek_Set);
} else bctx.ErrMessageBox("Start position > end position!","");
}
delete tmp_buff;
DumpMode = false;
return false;
}
FileUtilities* FStore::query_interface(BeyeContext& b) { return new(zeromem) FStore(b); }
class FRestore : public FStore {
public:
FRestore(BeyeContext&);
virtual ~FRestore();
virtual bool run();
static FileUtilities* query_interface(BeyeContext&);
};
FRestore::FRestore(BeyeContext& b):FStore(b) {}
FRestore::~FRestore() {}
bool FRestore::run()
{
__filesize_t endpos,cpos;
unsigned long flags;
bool ret = false;
flags = FSDLG_NOMODES;
__make_dump_name(".$$$");
char ffname[4096];
strcpy(ffname,ff_fname.c_str());
if(GetFStoreDlg(" Restore information from file ",ffname,&flags,&ff_startpos,&ff_len,FILE_PRMT)) {
ff_fname=ffname;
__filesize_t flen,lval;
binary_stream* h = new(zeromem) binary_stream;
std::string fname;
endpos = ff_startpos + ff_len;
if(!h->open(ff_fname,binary_stream::FO_READONLY | binary_stream::SO_DENYNONE)) {
if(!h->open(ff_fname,binary_stream::FO_READONLY | binary_stream::SO_COMPAT)) {
goto err;
}
}
flen = h->flength();
delete h;
lval = endpos - ff_startpos;
endpos = lval > flen ? flen + ff_startpos : endpos;
endpos = endpos > bctx.flength() ? bctx.flength() : endpos;
if(endpos > ff_startpos) {
__filesize_t wsize,cwpos;
unsigned remaind;
char* tmp_buff;
h = new(zeromem) binary_stream;
if(!h->open(ff_fname,binary_stream::FO_READONLY | binary_stream::SO_DENYNONE)) {
if(!h->open(ff_fname,binary_stream::FO_READONLY | binary_stream::SO_COMPAT)) {
err:
delete h;
bctx.errnoMessageBox(OPEN_FAIL,"",errno);
return false;
}
}
cpos = bctx.tell();
wsize = endpos - ff_startpos;
cwpos = ff_startpos;
h->seek(0L,binary_stream::Seek_Set);
tmp_buff = new char [4096];
fname = bctx.bm_file().filename();
std::fstream fs;
fs.open(fname.c_str(),std::ios_base::in|std::ios_base::out|std::ios_base::binary);
if(fs.is_open()) {
while(wsize) {
remaind = (unsigned)std::min(wsize,__filesize_t(4096));
binary_packet bp=h->read(remaind); memcpy(tmp_buff,bp.data(),bp.size());
if(bp.size()!=remaind) {
bctx.errnoMessageBox(READ_FAIL,"",errno);
delete h;
ret = false;
goto bye;
}
fs.seekp(cwpos,std::ios_base::beg);
fs.write(tmp_buff,remaind);
if(!fs.good()) {
bctx.errnoMessageBox(WRITE_FAIL,"",errno);
ret = false;
goto bye;
}
wsize -= remaind;
cwpos += remaind;
}
bye:
fs.close();
bctx.bm_file().reread();
} else bctx.errnoMessageBox(OPEN_FAIL,"",errno);
delete tmp_buff;
delete h;
bctx.bm_file().seek(cpos,binary_stream::Seek_Set);
ret = true;
} else bctx.ErrMessageBox("Start position > end position!","");
}
return ret;
}
FileUtilities* FRestore::query_interface(BeyeContext& b) { return new(zeromem) FRestore(b); }
class CryptBlock : public FileUtilities {
public:
CryptBlock(BeyeContext&);
virtual ~CryptBlock();
virtual bool run();
static FileUtilities* query_interface(BeyeContext&);
private:
void CryptFunc(char* buff,unsigned len,std::string& pass) const;
};
CryptBlock::CryptBlock(BeyeContext& b):FileUtilities(b) {}
CryptBlock::~CryptBlock() {}
void CryptBlock::CryptFunc(char* buff,unsigned len,std::string& pass) const
{
char ch,cxor;
unsigned i,j;
unsigned bigkey_idx;
unsigned passlen;
char big_key[UCHAR_MAX];
cxor = 0;
passlen = pass.length();
::memset(big_key,0,sizeof(big_key));
for(j = 0;j < passlen;j++) cxor += pass[j]+j;
cxor ^= passlen + len;
for(j = i = 0;i < UCHAR_MAX;i++,j++) {
if(j > passlen) j = 0;
bigkey_idx = (pass[j] + i) * cxor;
if(bigkey_idx > UCHAR_MAX) bigkey_idx = (bigkey_idx & 0xFF) ^ ((bigkey_idx >> 8) & 0xFF);
big_key[i] = bigkey_idx;
}
for(bigkey_idx = j = i = 0;i < len;i++,bigkey_idx++,j++) {
unsigned short _xor;
if(bigkey_idx > UCHAR_MAX) {
/** rotate of big key */
ch = big_key[0];
::memmove(big_key,&big_key[1],UCHAR_MAX-1);
big_key[UCHAR_MAX-1] = ch;
bigkey_idx = 0;
}
if(j > passlen) j = 0;
_xor = (big_key[bigkey_idx] + i)*cxor;
if(_xor > UCHAR_MAX) _xor = (_xor & 0xFF) ^ ((_xor >> 8) & 0xFF);
buff[i] = buff[i] ^ _xor;
}
/** rotate of pass */
ch = pass[0];
pass = pass.substr(1);
pass[passlen-1] = ch;
}
bool CryptBlock::run()
{
__filesize_t endpos,cpos;
unsigned long flags;
char pass[81];
bool ret;
ret = false;
ff_startpos = bctx.tell();
if(!ff_len) ff_len = bctx.flength() - ff_startpos;
pass[0] = 0;
flags = FSDLG_NOMODES;
if(GetFStoreDlg(" (De)Crypt block of file ",pass,&flags,&ff_startpos,&ff_len,"Input password (WARNING! password will be displayed):")) {
std::string passwd = pass;
__filesize_t flen,lval;
endpos = ff_startpos + ff_len;
flen = bctx.flength();
lval = endpos - ff_startpos;
endpos = lval > flen ? flen + ff_startpos : endpos;
endpos = endpos > bctx.flength() ? bctx.flength() : endpos;
if(!passwd[0]) { bctx.ErrMessageBox("Password can't be empty",""); return false; }
if(endpos > ff_startpos) {
__filesize_t wsize,cwpos;
unsigned remaind;
std::string fname;
char* tmp_buff;
cpos = bctx.tell();
wsize = endpos - ff_startpos;
cwpos = ff_startpos;
tmp_buff = new char [4096];
fname = bctx.bm_file().filename();
std::fstream fs;
fs.open(fname.c_str(),std::ios_base::in|std::ios_base::out|std::ios_base::binary);
if(fs.is_open()) {
fs.seekg(ff_startpos,std::ios_base::beg);
while(wsize) {
remaind = (unsigned)std::min(wsize,__filesize_t(4096));
fs.read(tmp_buff,remaind);
if(!fs.good()) {
bctx.errnoMessageBox(READ_FAIL,"",errno);
ret = false;
goto bye;
}
CryptFunc(tmp_buff,remaind,passwd);
fs.seekp(cwpos,std::ios_base::beg);
fs.write(tmp_buff,remaind);
if(!fs.good()) {
bctx.errnoMessageBox(WRITE_FAIL,"",errno);
ret = false;
goto bye;
}
wsize -= remaind;
cwpos += remaind;
}
bye:
fs.close();
bctx.bm_file().reread();
}
delete tmp_buff;
bctx.bm_file().seek(cpos,binary_stream::Seek_Set);
ret = true;
} else bctx.ErrMessageBox("Start position > end position!","");
}
return ret;
}
FileUtilities* CryptBlock::query_interface(BeyeContext& b) { return new(zeromem) CryptBlock(b); }
class EndianifyBlock : public FileUtilities {
public:
EndianifyBlock(BeyeContext&);
virtual ~EndianifyBlock();
virtual bool run();
static FileUtilities* query_interface(BeyeContext&);
private:
void EndianifyFunc(char* buff,unsigned len, int type) const;
};
EndianifyBlock::EndianifyBlock(BeyeContext& b):FileUtilities(b) {}
EndianifyBlock::~EndianifyBlock() {}
void EndianifyBlock::EndianifyFunc(char* buff,unsigned len, int type) const
{
unsigned i, step;
if(!type) return; /* for now */
switch(type) {
default:
case 3: step = 8;
break;
case 2: step = 4;
break;
case 1:
step = 2;
break;
}
len /= step;
len *= step;
for(i = 0;i < len;i+=step, buff+=step) {
switch(type) {
default:
case 3:
*((uint64_t *)buff) = bswap_64(*((uint64_t *)buff));
break;
case 2:
*((uint32_t *)buff) = bswap_32(*((uint32_t *)buff));
break;
case 1:
*((uint16_t *)buff) = bswap_16(*((uint16_t *)buff));
break;
}
}
}
bool EndianifyBlock::run()
{
__filesize_t endpos,cpos;
unsigned long flags;
bool ret;
ret = false;
ff_startpos = bctx.tell();
if(!ff_len) ff_len = bctx.flength() - ff_startpos;
flags = FSDLG_USEBITNS;
if(GetFStoreDlg(" Endianify block of file ",NULL,&flags,&ff_startpos,&ff_len,"")) {
__filesize_t flen,lval;
endpos = ff_startpos + ff_len;
flen = bctx.flength();
lval = endpos - ff_startpos;
endpos = lval > flen ? flen + ff_startpos : endpos;
endpos = endpos > bctx.flength() ? bctx.flength() : endpos;
if(endpos > ff_startpos) {
__filesize_t wsize,cwpos;
unsigned remaind;
std::string fname;
std::fstream fs;
char* tmp_buff;
cpos = bctx.tell();
wsize = endpos - ff_startpos;
cwpos = ff_startpos;
tmp_buff = new char [4096];
fname = bctx.bm_file().filename();
fs.open(fname.c_str(),std::ios_base::in|std::ios_base::out|std::ios_base::binary);
if(fs.is_open()) {
fs.seekg(ff_startpos,std::ios_base::beg);
while(wsize) {
remaind = (unsigned)std::min(wsize,__filesize_t(4096));
fs.read(tmp_buff,remaind);
if(!fs.good()) {
bctx.errnoMessageBox(READ_FAIL,"",errno);
ret = false;
goto bye;
}
EndianifyFunc(tmp_buff,remaind, flags & FSDLG_BTNSMASK);
fs.seekp(cwpos,std::ios_base::beg);
fs.write(tmp_buff,remaind);
if(!fs.good()) {
bctx.errnoMessageBox(WRITE_FAIL,"",errno);
ret = false;
goto bye;
}
wsize -= remaind;
cwpos += remaind;
}
bye:
fs.close();
bctx.bm_file().reread();
}
delete tmp_buff;
bctx.bm_file().seek(cpos,binary_stream::Seek_Set);
ret = true;
} else bctx.ErrMessageBox("Start position > end position!","");
}
return ret;
}
FileUtilities* EndianifyBlock::query_interface(BeyeContext& b) { return new(zeromem) EndianifyBlock(b); }
class XLatBlock : public FileUtilities {
public:
XLatBlock(BeyeContext&);
virtual ~XLatBlock();
virtual bool run();
static FileUtilities* query_interface(BeyeContext&);
private:
void XLatFunc(char* buff,unsigned len, const unsigned char *xlt) const;
std::string xlat_fname;
};
XLatBlock::XLatBlock(BeyeContext& b):FileUtilities(b) {}
XLatBlock::~XLatBlock() {}
void XLatBlock::XLatFunc(char* buff,unsigned len, const unsigned char *xlt) const
{
unsigned i;
for(i = 0;i < len;i++) buff[i] = xlt[(int)buff[i]];
}
bool XLatBlock::run()
{
unsigned char xlt[256];
__filesize_t endpos,cpos;
unsigned long flags;
bool ret;
ret = false;
ff_startpos = bctx.tell();
if(!ff_len) ff_len = bctx.flength() - ff_startpos;
flags = FSDLG_NOMODES;
if(xlat_fname.empty()) xlat_fname=bctx.system().get_rc_dir("beye")+"xlt";
char ffname[4096];
strcpy(ffname,xlat_fname.c_str());
if(GetFStoreDlg(" Table Look-up Translation ",ffname,&flags,&ff_startpos,&ff_len,XLAT_PRMT)) {
xlat_fname=ffname;
__filesize_t flen,lval;
endpos = ff_startpos + ff_len;
flen = bctx.flength();
lval = endpos - ff_startpos;
endpos = lval > flen ? flen + ff_startpos : endpos;
endpos = endpos > bctx.flength() ? bctx.flength() : endpos;
if(endpos > ff_startpos) {
__filesize_t wsize,cwpos;
unsigned remaind;
std::string fname;
char* tmp_buff;
cpos = bctx.tell();
wsize = endpos - ff_startpos;
cwpos = ff_startpos;
/* Parse xlat file */
binary_stream* xHandle;
xHandle = BeyeContext::beyeOpenRO(xlat_fname,BBIO_SMALL_CACHE_SIZE);
if(xHandle == NULL) {
bctx.ErrMessageBox("Can't open xlat file", "");
return false;
}
if(xHandle->flength() != 320) {
bctx.ErrMessageBox("Size of xlat file is not 320 bytes", "");
delete xHandle;
return false;
}
binary_packet bp=xHandle->read(16); memcpy(xlt,bp.data(),bp.size());
if(memcmp(xlt, "Beye Xlat Table.", 16) != 0) {
bctx.ErrMessageBox("It seems that xlat file is corrupt", "");
delete xHandle;
return false;
}
xHandle->seek(0x40, binary_stream::Seek_Set);
bp=xHandle->read(256); memcpy(xlt,bp.data(),bp.size());
delete xHandle;
tmp_buff = new char [4096];
std::fstream fs;
fname = bctx.bm_file().filename();
fs.open(fname.c_str(),std::ios_base::binary);
if(fs.is_open()) {
fs.seekg(ff_startpos,std::ios_base::beg);
while(wsize) {
remaind = (unsigned)std::min(wsize,__filesize_t(4096));
fs.read(tmp_buff,remaind);
if(!fs.good()) {
bctx.errnoMessageBox(READ_FAIL,"",errno);
ret = false;
goto bye;
}
XLatFunc(tmp_buff,remaind, xlt);
fs.seekp(cwpos,std::ios_base::beg);
fs.write(tmp_buff,remaind);
if(!fs.good()) {
bctx.errnoMessageBox(WRITE_FAIL,"",errno);
ret = false;
goto bye;
}
wsize -= remaind;
cwpos += remaind;
}
bye:
fs.close();
bctx.bm_file().reread();
}
delete tmp_buff;
bctx.bm_file().seek(cpos,binary_stream::Seek_Set);
ret = true;
} else bctx.ErrMessageBox("Start position > end position!","");
}
return ret;
}
FileUtilities* XLatBlock::query_interface(BeyeContext& b) { return new(zeromem) XLatBlock(b); }
class FileInfo : public FileUtilities {
public:
FileInfo(BeyeContext&);
virtual ~FileInfo();
virtual bool run();
static FileUtilities* query_interface(BeyeContext&);
};
FileInfo::FileInfo(BeyeContext& b):FileUtilities(b) {}
FileInfo::~FileInfo() {}
bool FileInfo::run()
{
TWindow* wnd;
struct stat statbuf;
unsigned evt;
char attr[14];
char stimes[3][80];
::memset(&statbuf,0,sizeof(struct stat));
::stat(bctx.bm_file().filename().c_str(),&statbuf);
::memset(attr,'-',sizeof(attr));
attr[sizeof(attr)-1] = 0;
#ifdef S_IXOTH /** Execute by other */
if((statbuf.st_mode & S_IXOTH) == S_IXOTH) attr[12] = 'X';
#endif
#ifdef S_IWOTH /** Write by other */
if((statbuf.st_mode & S_IWOTH) == S_IWOTH) attr[11] = 'W';
#endif
#ifdef S_IROTH /** Read by other */
if((statbuf.st_mode & S_IROTH) == S_IROTH) attr[10] = 'R';
#endif
#ifdef S_IXGRP /** Execute by group */
if((statbuf.st_mode & S_IXGRP) == S_IXGRP) attr[9] = 'X';
#endif
#ifdef S_IWGRP /** Write by group */
if((statbuf.st_mode & S_IWGRP) == S_IWGRP) attr[8] = 'W';
#endif
#ifdef S_IRGRP /** Read by group */
if((statbuf.st_mode & S_IRGRP) == S_IRGRP) attr[7] = 'R';
#endif
#ifdef S_IEXEC /** Execute by owner */
if((statbuf.st_mode & S_IEXEC) == S_IEXEC) attr[6] = 'X';
#endif
#ifdef S_IWRITE /** Write by owner */
if((statbuf.st_mode & S_IWRITE) == S_IWRITE) attr[5] = 'W';
#endif
#ifdef S_IREAD /** Read by owner */
if((statbuf.st_mode & S_IREAD) == S_IREAD) attr[4] = 'R';
#endif
#ifdef S_ISVTX /** Save swapped text after use (obsolete) */
if((statbuf.st_mode & S_ISVTX) == S_ISVTX) attr[3] = 'V';
#endif
#ifdef S_ISGID /** Set GID on execution */
if((statbuf.st_mode & S_ISGID) == S_ISGID) attr[2] = 'G';
#endif
#ifdef S_ISUID /** Set UID on execution */
if((statbuf.st_mode & S_ISUID) == S_ISUID) attr[1] = 'U';
#endif
#ifdef S_ISFIFO /** it FIFO */
if(S_ISFIFO(statbuf.st_mode)) attr[0] = 'F';
#endif
#ifdef S_IFCHR /** it character device */
if((statbuf.st_mode & S_IFCHR) == S_IFCHR) attr[0] = 'C';
#endif
#ifdef S_IFDIR /** it directory */
if((statbuf.st_mode & S_IFDIR) == S_IFDIR) attr[0] = 'D';
#endif
#ifdef S_IFBLK /** it block device */
if((statbuf.st_mode & S_IFBLK) == S_IFBLK) attr[0] = 'B';
#endif
#ifdef S_IFREG /** it regular file (not dir or node) */
if((statbuf.st_mode & S_IFREG) == S_IFREG) attr[0] = 'f';
#endif
#ifdef S_IFLNK /** it symbolic link */
if((statbuf.st_mode & S_IFLNK) == S_IFLNK) attr[0] = 'L';
#endif
#ifdef S_IFSOCK /** it socket */
if((statbuf.st_mode & S_IFSOCK) == S_IFSOCK) attr[0] = 'S';
#endif
wnd = CrtDlgWndnls(" File information: ",bctx.tconsole().vio_width()-5,13);
wnd->goto_xy(1,1);
::strcpy(stimes[0],ctime(&statbuf.st_ctime));
::strcpy(stimes[1],ctime(&statbuf.st_mtime));
::strcpy(stimes[2],ctime(&statbuf.st_atime));
wnd->printf(
"Name = %s\n"
"Type = %s\n"
"Length = %llu bytes\n"
"Attributes = %s\n"
" TUGVOwnGrpOth\n"
"Creation time = %s"
"Modification time = %s"
"Last access time = %s"
"Device containing file = %u\n"
"File serial (inode) number = %u\n"
"Number of hard links to file = %u\n"
"User ID of the file owner = %u\n"
"Group ID of the file owner = %u"
,bctx.short_name()
,bctx.bin_format().name()
,bctx.flength()
,attr
,stimes[0]
,stimes[1]
,stimes[2]
,(unsigned)statbuf.st_dev
,(unsigned)statbuf.st_ino
,(unsigned)statbuf.st_nlink
,(unsigned)statbuf.st_uid
,(unsigned)statbuf.st_gid);
do {
evt = GetEvent(drawEmptyPrompt,NULL,wnd);
}while(!(evt == KE_ESCAPE || evt == KE_F(10)));
delete wnd;
return false;
}
FileUtilities* FileInfo::query_interface(BeyeContext& b) { return new(zeromem) FileInfo(b); }
struct file_utilities {
const char* name;
FileUtilities* (*query_interface)(BeyeContext&);
};
static const file_utilities utilities[] = {
{ "~File information...", FileInfo::query_interface },
{ "C~hange size of file", ChSize::query_interface },
{ "~Save block as...", FStore::query_interface },
{ "~Restore block from...", FRestore::query_interface },
{ "~Insert/delete block...", InsDelBlock::query_interface },
{ "~Crypt/decrypt block...", CryptBlock::query_interface },
{ "~Endianify block...", EndianifyBlock::query_interface },
{ "~Xlat block...", XLatBlock::query_interface }
};
bool FileUtils()
{
BeyeContext& bctx = beye_context();
size_t nUtils = sizeof(utilities)/sizeof(file_utilities);
std::vector<std::string> names;
int retval;
bool ret;
static unsigned def_sel = 0;
for(unsigned i=0;i<nUtils;i++) names.push_back(utilities[i].name);
ListBox lb(bctx);
retval = lb.run(names," File utilities: ",ListBox::Selective|ListBox::UseAcc,def_sel);
if(retval != -1) {
TWindow* w = PleaseWaitWnd();
FileUtilities* util = utilities[retval].query_interface(bctx);
ret = util->run();
delete util;
delete w;
def_sel = retval;
return ret;
}
return false;
}
} // namespace usr
| gpl-2.0 |
KarolBedkowski/wxgtd | wxgtd/wxtools/wxshell.py | 832 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable-msg=R0901, R0904
""" wxShell (pyCrust)
Copyright (c) Karol Będkowski, 2004-2013
This file is part of kPyLibs
This is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, version 2.
"""
__author__ = 'Karol Będkowski'
__copyright__ = 'Copyright (C) Karol Będkowski 2006-2013'
__version__ = "2013-04-27"
__all__ = ['WndShell']
import wx
import wx.py
class WndShell(wx.Frame):
""" Window with pyCrust.
Args:
parent: parent window
locals_vars: local variables to set in pyCrust.
"""
def __init__(self, parent, locals_vars):
wx.Frame.__init__(self, parent, -1, 'Shell', size=(700, 500))
wx.py.crust.Crust(self, locals=locals_vars)
self.Centre(wx.BOTH)
| gpl-2.0 |
janinko/ETS-ZA | ets-za/src/main/java/eu/janinko/etsza/ai/goals/Utility.java | 311 |
package eu.janinko.etsza.ai.goals;
import eu.janinko.etsza.ai.agents.Agent;
/**
*
* @author Honza Brázdil <janinko.g@gmail.com>
*/
public interface Utility<K extends Agent> {
//double getCurrentUtility(K h);
//double getUtilityWhen(WorldModel model);
void updatePlan(Plan plan, K agent);
}
| gpl-2.0 |
Sophist-UK/Sophist_picard | picard/formats/mutagenext/compatid3.py | 2421 | # -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2005 Michael Urman
# Copyright (C) 2006-2008, 2011-2012 Lukáš Lalinský
# Copyright (C) 2013-2014 Sophist-UK
# Copyright (C) 2013-2014, 2018 Laurent Monin
# Copyright (C) 2014, 2018-2019 Philipp Wolfer
# Copyright (C) 2016 Christoph Reiter
# Copyright (C) 2016 Ville Skyttä
# Copyright (C) 2017 Sambhav Kothari
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from mutagen.id3 import (
ID3,
Frames,
Frames_2_2,
TextFrame,
)
try:
from mutagen.id3 import GRP1
except ImportError:
class GRP1(TextFrame):
pass
class TCMP(TextFrame):
pass
class TSO2(TextFrame):
pass
class TSOC(TextFrame):
pass
class XDOR(TextFrame):
pass
class XSOP(TextFrame):
pass
known_frames = dict(Frames)
known_frames.update(dict(Frames_2_2))
known_frames["GRP1"] = GRP1
known_frames["TCMP"] = TCMP
known_frames["TSO2"] = TSO2
known_frames["TSOC"] = TSOC
known_frames["XDOR"] = XDOR
known_frames["XSOP"] = XSOP
class CompatID3(ID3):
"""
Additional features over mutagen.id3.ID3:
* iTunes' TCMP frame
* Allow some v2.4 frames also in v2.3
"""
PEDANTIC = False
def __init__(self, *args, **kwargs):
if args:
kwargs["known_frames"] = known_frames
super().__init__(*args, **kwargs)
def update_to_v23(self):
# leave TSOP, TSOA and TSOT even though they are officially defined
# only in ID3v2.4, because most applications use them also in ID3v2.3
frames = []
for key in ["TSOP", "TSOA", "TSOT", "TSST"]:
frames.extend(self.getall(key))
super().update_to_v23()
for frame in frames:
self.add(frame)
| gpl-2.0 |
smeny/JPC | src/main/java/com/github/smeny/jpc/emulator/execution/opcodes/rm/fprem.java | 2744 | /*
JPC: An x86 PC Hardware Emulator for a pure Java Virtual Machine
Copyright (C) 2012-2013 Ian Preston
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Details (including contact information) can be found at:
jpc.sourceforge.net
or the developer website
sourceforge.net/projects/jpc/
End of licence header
*/
package com.github.smeny.jpc.emulator.execution.opcodes.rm;
import com.github.smeny.jpc.emulator.execution.*;
import com.github.smeny.jpc.emulator.execution.decoder.*;
import com.github.smeny.jpc.emulator.processor.*;
import com.github.smeny.jpc.emulator.processor.fpu64.*;
import static com.github.smeny.jpc.emulator.processor.Processor.*;
public class fprem extends Executable
{
public fprem(int blockStart, int eip, int prefices, PeekableInputStream input)
{
super(blockStart, eip);
}
public Branch execute(Processor cpu)
{
double freg0 = cpu.fpu.ST(0);
double freg1 = cpu.fpu.ST(1);
int d = Math.getExponent(freg0) - Math.getExponent(freg1);
if (d < 64)
{
// full remainder
cpu.fpu.conditionCode &= ~4; // clear C2
freg0 = freg0 % freg1;
// compute least significant bits -> C0 C3 C1
long i = (long)Math.rint(freg0 / freg1);
cpu.fpu.conditionCode &= 4;
if ((i & 1) != 0) cpu.fpu.conditionCode |= 2;
if ((i & 2) != 0) cpu.fpu.conditionCode |= 8;
if ((i & 4) != 0) cpu.fpu.conditionCode |= 1;
}
else
{
// partial remainder
cpu.fpu.conditionCode |= 4; // set C2
int n = 63; // implementation dependent in manual
double f = Math.pow(2.0, (double)(d - n));
double z = (freg0 / freg1) / f;
double qq = (z < 0) ? Math.ceil(z) : Math.floor(z);
freg0 = freg0 - (freg1 * qq * f);
}
cpu.fpu.setST(0, freg0);
return Branch.None;
}
public boolean isBranch()
{
return false;
}
public String toString()
{
return this.getClass().getName();
}
} | gpl-2.0 |
billf5293/javampd | src/test/java/org/bff/javampd/command/MPDCommandExecutorTest.java | 10350 | package org.bff.javampd.command;
import org.bff.javampd.server.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
public class MPDCommandExecutorTest {
@Mock
private MPDSocket mpdSocket;
@Mock
private MPD mpd;
@InjectMocks
private MPDCommandExecutor commandExecutor;
@Test
public void testGetVersion() throws UnknownHostException {
when(mpd.getAddress()).thenReturn(InetAddress.getLocalHost());
when(mpd.getPort()).thenReturn(8080);
when(mpd.getTimeout()).thenReturn(0);
when(mpdSocket.getVersion()).thenReturn("version");
assertEquals("version", commandExecutor.getMPDVersion());
}
@Test(expected = MPDConnectionException.class)
public void testSendCommandNoMPDSet() {
commandExecutor = new MPDCommandExecutor();
commandExecutor.sendCommand("command");
}
@Test
public void testSendCommandString() {
String commandString = "command";
MPDCommand command = new MPDCommand(commandString);
commandExecutor = new TestMPDCommandExecutor();
commandExecutor.setMpd(mpd);
List<String> testResponse = new ArrayList<>();
testResponse.add("testResponse");
when(mpdSocket.sendCommand(command))
.thenReturn(testResponse);
List<String> response = commandExecutor.sendCommand(commandString);
assertEquals(response.get(0), testResponse.get(0));
}
@Test
public void testSendCommand() {
MPDCommand command = new MPDCommand("command");
commandExecutor = new TestMPDCommandExecutor();
commandExecutor.setMpd(mpd);
List<String> testResponse = new ArrayList<>();
testResponse.add("testResponse");
when(mpdSocket.sendCommand(command))
.thenReturn(testResponse);
List<String> response = commandExecutor.sendCommand(command);
assertEquals(response.get(0), testResponse.get(0));
}
@Test
public void testSendCommandWithStringParams() {
String commandString = "command";
String paramString = "param";
MPDCommand command = new MPDCommand(commandString, paramString);
commandExecutor = new TestMPDCommandExecutor();
commandExecutor.setMpd(mpd);
List<String> testResponse = new ArrayList<>();
testResponse.add("testResponse");
when(mpdSocket.sendCommand(command))
.thenReturn(testResponse);
List<String> response = commandExecutor.sendCommand(commandString, paramString);
assertEquals(response.get(0), testResponse.get(0));
}
@Test
public void testSendCommandWithIntegerParams() {
String commandString = "command";
Integer paramInteger = 1;
MPDCommand command = new MPDCommand(commandString, Integer.toString(paramInteger));
commandExecutor = new TestMPDCommandExecutor();
commandExecutor.setMpd(mpd);
List<String> testResponse = new ArrayList<>();
testResponse.add("testResponse");
when(mpdSocket.sendCommand(command))
.thenReturn(testResponse);
List<String> response = commandExecutor.sendCommand(commandString, paramInteger);
assertEquals(response.get(0), testResponse.get(0));
}
@Test
public void testSendCommandSecurityException() {
commandExecutor = new TestMPDCommandExecutor();
commandExecutor.setMpd(mpd);
MPDCommand command = new MPDCommand("command");
MPDCommand passwordCommand = new MPDCommand("password", "password");
when(mpdSocket.sendCommand(passwordCommand))
.thenReturn(new ArrayList<>())
.thenReturn(new ArrayList<>());
List<String> testResponse = new ArrayList<>();
testResponse.add("testResponse");
when(mpdSocket.sendCommand(command))
.thenThrow(new MPDSecurityException("exception"))
.thenReturn(testResponse);
List<String> response = new ArrayList<>(commandExecutor.sendCommand(command));
assertEquals(response.get(0), testResponse.get(0));
}
@Test
public void testSendCommandsSecurityException() {
commandExecutor = new TestMPDCommandExecutor();
commandExecutor.setMpd(mpd);
MPDCommand command1 = new MPDCommand("command1");
MPDCommand command2 = new MPDCommand("command2");
List<MPDCommand> commands = new ArrayList<>();
commands.add(command1);
commands.add(command2);
MPDCommand passwordCommand = new MPDCommand("password", "password");
when(mpdSocket.sendCommand(passwordCommand))
.thenReturn(new ArrayList<>())
.thenReturn(new ArrayList<>());
doThrow(new MPDSecurityException("exception"))
.doNothing()
.when(mpdSocket).sendCommands(commands);
commandExecutor.sendCommands(commands);
}
@Test
public void testSendCommands() {
commandExecutor = new TestMPDCommandExecutor();
commandExecutor.setMpd(mpd);
MPDCommand command1 = new MPDCommand("command1");
MPDCommand command2 = new MPDCommand("command2");
List<MPDCommand> commands = new ArrayList<>();
commands.add(command1);
commands.add(command2);
doNothing().when(mpdSocket).sendCommands(commands);
commandExecutor.sendCommands(commands);
}
@Test
public void testCreateSocket() throws Exception {
ServerSocket socket = null;
try {
socket = new ServerSocket(0);
socket.setReuseAddress(true);
int port = socket.getLocalPort();
when(mpd.getAddress()).thenReturn(InetAddress.getLocalHost());
when(mpd.getPort()).thenReturn(port);
when(mpd.getTimeout()).thenReturn(5000);
ServerSocket finalSocket = socket;
new Thread(() -> {
Socket clientSocket = null;
try {
clientSocket = finalSocket.accept();
PrintWriter pw = new PrintWriter(clientSocket.getOutputStream(), true);
pw.write("OK MPD Version\r\n");
pw.flush();
} catch (IOException e) {
e.printStackTrace();
}
}).start();
commandExecutor.setMpd(mpd);
assertNotNull(commandExecutor.createSocket());
} finally {
if (socket != null) {
socket.close();
}
}
}
@Test(expected = MPDConnectionException.class)
public void testCommandObjectNoMPDSet() {
commandExecutor = new MPDCommandExecutor();
MPDCommand command = new MPDCommand("command");
commandExecutor.sendCommand(command);
}
@Test(expected = MPDConnectionException.class)
public void testCommandStringParamsNoMPDSet() {
commandExecutor = new MPDCommandExecutor();
commandExecutor.sendCommand("command", "param1", "param2");
}
@Test(expected = MPDConnectionException.class)
public void testCommandStringIntegerParamsNoMPDSet() {
commandExecutor = new MPDCommandExecutor();
commandExecutor.sendCommand("command", 1, 2, 3);
}
@Test(expected = MPDConnectionException.class)
public void testGetVersionNoMPDSet() {
commandExecutor = new MPDCommandExecutor();
commandExecutor.getMPDVersion();
}
@Test(expected = MPDConnectionException.class)
public void testSendCommandsNoMPDSet() {
commandExecutor = new MPDCommandExecutor();
List<MPDCommand> commands = new ArrayList<MPDCommand>();
commands.add(new MPDCommand("command1"));
commands.add(new MPDCommand("command2"));
commands.add(new MPDCommand("command3"));
commandExecutor.sendCommands(commands);
}
@Test(expected = IllegalArgumentException.class)
public void testAuthenticateIllegalArgument() throws Exception {
commandExecutor.usePassword(null);
}
@Test
public void testAuthentication() {
String password = "password";
ServerProperties serverProperties = new ServerProperties();
MPDCommand command = new MPDCommand(serverProperties.getPassword(), password);
List<String> testResponse = new ArrayList<>();
testResponse.add("testResponse");
when(mpdSocket.sendCommand(command)).thenReturn(testResponse);
commandExecutor.usePassword(password);
commandExecutor.authenticate();
}
@Test(expected = MPDSecurityException.class)
public void testAuthenticateSecurityException() {
String password = "password";
ServerProperties serverProperties = new ServerProperties();
MPDCommand command = new MPDCommand(serverProperties.getPassword(), password);
when(mpdSocket.sendCommand(command)).thenThrow(new RuntimeException("incorrect password"));
commandExecutor.usePassword(password);
commandExecutor.authenticate();
}
@Test(expected = MPDConnectionException.class)
public void testAuthenticateGeneralException() {
String password = "password";
ServerProperties serverProperties = new ServerProperties();
MPDCommand command = new MPDCommand(serverProperties.getPassword(), password);
when(mpdSocket.sendCommand(command)).thenThrow(new RuntimeException());
commandExecutor.usePassword(password);
commandExecutor.authenticate();
}
@Test
public void testClose() {
commandExecutor.close();
verify(mpdSocket).close();
}
private class TestMPDCommandExecutor extends MPDCommandExecutor {
@Override
protected MPDSocket createSocket() {
return mpdSocket;
}
}
}
| gpl-2.0 |
hantsairquality/monitor_v1 | bmp180.py | 4038 | #!/usr/bin/python
#--------------------------------------
# ___ ___ _ ____
# / _ \/ _ \(_) __/__ __ __
# / , _/ ___/ /\ \/ _ \/ // /
# /_/|_/_/ /_/___/ .__/\_, /
# /_/ /___/
#
# bmp180.py
# Read data from a digital pressure sensor.
#
# Author : Matt Hawkins
# Date : 17/02/2017
#
# http://www.raspberrypi-spy.co.uk/
#
#--------------------------------------
import smbus
import time
import json
import socket
import datetime
import time
from ctypes import c_short
import csv
PORT = 33333;
HOST = '127.0.0.1'
remote_PORT = 33333
remote_HOST = '138.68.134.165'
csvFile="/home/pi/AirQuality/client/bmp.log"
w = csv.writer(open(csvFile,'a'),dialect='excel')
DEVICE = 0x77 # Default device I2C address
#bus = smbus.SMBus(0) # Rev 1 Pi uses 0
bus = smbus.SMBus(1) # Rev 2 Pi uses 1
def convertToString(data):
# Simple function to convert binary data into
# a string
return str((data[1] + (256 * data[0])) / 1.2)
def getShort(data, index):
# return two bytes from data as a signed 16-bit value
return c_short((data[index] << 8) + data[index + 1]).value
def getUshort(data, index):
# return two bytes from data as an unsigned 16-bit value
return (data[index] << 8) + data[index + 1]
def readBmp180Id(addr=DEVICE):
# Chip ID Register Address
REG_ID = 0xD0
(chip_id, chip_version) = bus.read_i2c_block_data(addr, REG_ID, 2)
return (chip_id, chip_version)
def readBmp180(addr=DEVICE):
# Register Addresses
REG_CALIB = 0xAA
REG_MEAS = 0xF4
REG_MSB = 0xF6
REG_LSB = 0xF7
# Control Register Address
CRV_TEMP = 0x2E
CRV_PRES = 0x34
# Oversample setting
OVERSAMPLE = 3 # 0 - 3
# Read calibration data
# Read calibration data from EEPROM
cal = bus.read_i2c_block_data(addr, REG_CALIB, 22)
# Convert byte data to word values
AC1 = getShort(cal, 0)
AC2 = getShort(cal, 2)
AC3 = getShort(cal, 4)
AC4 = getUshort(cal, 6)
AC5 = getUshort(cal, 8)
AC6 = getUshort(cal, 10)
B1 = getShort(cal, 12)
B2 = getShort(cal, 14)
MB = getShort(cal, 16)
MC = getShort(cal, 18)
MD = getShort(cal, 20)
# Read temperature
bus.write_byte_data(addr, REG_MEAS, CRV_TEMP)
time.sleep(0.005)
(msb, lsb) = bus.read_i2c_block_data(addr, REG_MSB, 2)
UT = (msb << 8) + lsb
# Read pressure
bus.write_byte_data(addr, REG_MEAS, CRV_PRES + (OVERSAMPLE << 6))
time.sleep(0.04)
(msb, lsb, xsb) = bus.read_i2c_block_data(addr, REG_MSB, 3)
UP = ((msb << 16) + (lsb << 8) + xsb) >> (8 - OVERSAMPLE)
# Refine temperature
X1 = ((UT - AC6) * AC5) >> 15
X2 = (MC << 11) / (X1 + MD)
B5 = X1 + X2
temperature = int(B5 + 8) >> 4
# Refine pressure
B6 = B5 - 4000
B62 = int(B6 * B6) >> 12
X1 = (B2 * B62) >> 11
X2 = int(AC2 * B6) >> 11
X3 = X1 + X2
B3 = (((AC1 * 4 + X3) << OVERSAMPLE) + 2) >> 2
X1 = int(AC3 * B6) >> 13
X2 = (B1 * B62) >> 16
X3 = ((X1 + X2) + 2) >> 2
B4 = (AC4 * (X3 + 32768)) >> 15
B7 = (UP - B3) * (50000 >> OVERSAMPLE)
P = (B7 * 2) / B4
X1 = (int(P) >> 8) * (int(P) >> 8)
X1 = (X1 * 3038) >> 16
X2 = int(-7357 * P) >> 16
pressure = int(P + ((X1 + X2 + 3791) >> 4))
return (temperature/10.0,pressure/100.0)
def main():
(chip_id, chip_version) = readBmp180Id()
print("Chip ID : {0}".format(chip_id))
print("Version : {0}".format(chip_version))
while 1:
try:
(temperature,pressure)=readBmp180()
message = {"_type": "bmp", "$timestamp": str(datetime.datetime.now()),"$TEMP": temperature, "$PRES": pressure}
message = json.dumps(message)
w.writerow(message)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(message, (HOST, PORT))
sock.sendto(message, (remote_HOST, remote_PORT))
print(message)
print("Temperature : {0} C".format(temperature))
print("Pressure : {0} mbar".format(pressure))
time.sleep(0.8)
except KeyboardInterrupt:
break
if __name__=="__main__":
main()
| gpl-2.0 |
fengzhongdege/TIJ4 | src/main/java/course/holding/ListFeatures.java | 2889 | //: holding/ListFeatures.java
package course.holding; /* Added by Eclipse.py */
import typeinfo.pets.*;
import java.util.*;
import static net.mindview.util.Print.*;
public class ListFeatures {
public static void main(String[] args) {
Random rand = new Random(47);
List<Pet> pets = Pets.arrayList(7);
print("1: " + pets);
Hamster h = new Hamster();
pets.add(h); // Automatically resizes
print("2: " + pets);
print("3: " + pets.contains(h));
pets.remove(h); // Remove by object
Pet p = pets.get(2);
print("4: " + p + " " + pets.indexOf(p));
Pet cymric = new Cymric();
print("5: " + pets.indexOf(cymric));
print("6: " + pets.remove(cymric));
// Must be the exact object:
print("7: " + pets.remove(p));
print("8: " + pets);
pets.add(3, new Mouse()); // Insert at an index
print("9: " + pets);
List<Pet> sub = pets.subList(1, 4);
print("subList: " + sub);
print("10: " + pets.containsAll(sub));
Collections.sort(sub); // In-place sort
print("sorted subList: " + sub);
// Order is not important in containsAll():
print("11: " + pets.containsAll(sub));
Collections.shuffle(sub, rand); // Mix it up
print("shuffled subList: " + sub);
print("12: " + pets.containsAll(sub));
List<Pet> copy = new ArrayList<Pet>(pets);
sub = Arrays.asList(pets.get(1), pets.get(4));
print("sub: " + sub);
copy.retainAll(sub);
print("13: " + copy);
copy = new ArrayList<Pet>(pets); // Get a fresh copy
copy.remove(2); // Remove by index
print("14: " + copy);
copy.removeAll(sub); // Only removes exact objects
print("15: " + copy);
copy.set(1, new Mouse()); // Replace an element
print("16: " + copy);
copy.addAll(2, sub); // Insert a list in the middle
print("17: " + copy);
print("18: " + pets.isEmpty());
pets.clear(); // Remove all elements
print("19: " + pets);
print("20: " + pets.isEmpty());
pets.addAll(Pets.arrayList(4));
print("21: " + pets);
Object[] o = pets.toArray();
print("22: " + o[3]);
Pet[] pa = pets.toArray(new Pet[0]);
print("23: " + pa[3].id());
}
} /* Output:
1: [Rat, Manx, Cymric, Mutt, Pug, Cymric, Pug]
2: [Rat, Manx, Cymric, Mutt, Pug, Cymric, Pug, Hamster]
3: true
4: Cymric 2
5: -1
6: false
7: true
8: [Rat, Manx, Mutt, Pug, Cymric, Pug]
9: [Rat, Manx, Mutt, Mouse, Pug, Cymric, Pug]
subList: [Manx, Mutt, Mouse]
10: true
sorted subList: [Manx, Mouse, Mutt]
11: true
shuffled subList: [Mouse, Manx, Mutt]
12: true
sub: [Mouse, Pug]
13: [Mouse, Pug]
14: [Rat, Mouse, Mutt, Pug, Cymric, Pug]
15: [Rat, Mutt, Cymric, Pug]
16: [Rat, Mouse, Cymric, Pug]
17: [Rat, Mouse, Mouse, Pug, Cymric, Pug]
18: false
19: []
20: true
21: [Manx, Cymric, Rat, EgyptianMau]
22: EgyptianMau
23: 14
*///:~
| gpl-2.0 |
ovidiul/XCloner-Wordpress | admin/partials/xcloner_init_page.php | 13700 | <?php
/**
* Provide a admin area view for the plugin
*
* This file is used to markup the admin-facing aspects of the plugin.
*
* @link http://www.thinkovi.com
* @since 1.0.0
*
* @package Xcloner
* @subpackage Xcloner/admin/partials
*/
$requirements = $this->get_xcloner_container()->get_xcloner_requirements();
$xcloner_settings = $this->get_xcloner_container()->get_xcloner_settings();
$xcloner_file_system = $this->get_xcloner_container()->get_xcloner_filesystem();
$logger = $this->get_xcloner_container()->get_xcloner_logger();
$xcloner_scheduler = $this->get_xcloner_container()->get_xcloner_scheduler();
$logger_content = $logger->getLastDebugLines();
$date_format = get_option('date_format');
$time_format = get_option('time_format');
//$xcloner_file_system->cleanup_tmp_directories();
if ($requirements->check_backup_ready_status()) {
$latest_backup = $xcloner_file_system->get_latest_backup();
$xcloner_file_system->backup_storage_cleanup();
}
?>
<div class="row">
<div class="col s12">
<h5 class="left-align">
<?php echo __('Backup Dashboard', 'xcloner-backup-and-restore') ?>
</h5>
</div>
</div>
<?php if (isset($latest_backup['timestamp']) and $latest_backup['timestamp'] < strtotime("-1 day")): ?>
<div id="setting-error-" class="error settings-error notice is-dismissible">
<p><strong>
<?php echo __('Your latest backup is older than 24 hours, please create a new backup to keep your site protected.', 'xcloner-backup-and-restore') ?>
</strong>
</p>
<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span>
</button>
</div>
<?php endif ?>
<?php if (!isset($latest_backup['timestamp'])): ?>
<div id="setting-error-" class="error settings-error notice is-dismissible">
<p><strong>
<?php echo __('You have no backup that I could find, please generate a new backup to keep your site protected.', 'xcloner-backup-and-restore') ?>
</strong>
</p>
<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span>
</button>
</div>
<?php endif ?>
<?php if (!$requirements->check_backup_ready_status()): ?>
<div id="setting-error-" class="error settings-error notice is-dismissible">
<p><strong>
<?php echo __('Backup system not ready, please check and fix the issues marked in red', 'xcloner-backup-and-restore') ?>
</strong>
</p>
<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span>
</button>
</div>
<?php endif ?>
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
<div class="row dashboard">
<div class="col s12 m12 l7">
<div class="row">
<ul class="collapsible xcloner-debugger" data-collapsible="accordion">
<li class="active">
<div class="collapsible-header active"><i class="material-icons">info</i>Backup Status</div>
<div class="collapsible-body">
<div class="" id="backup-status">
<div class="row">
<h5><?php echo __("Latest Backup", 'xcloner-backup-and-restore') ?></h5>
<blockquote>
<?php if (isset($latest_backup)): ?>
<div class="item">
<div class="title"><?php echo __("Backup Name", 'xcloner-backup-and-restore') ?>
:
</div>
<?php echo $latest_backup['basename'] ?>
</div>
<div class="item">
<div class="title">
<?php echo __("Backup Size", 'xcloner-backup-and-restore') ?>:
</div>
<?php echo size_format($latest_backup['size']) ?>
</div>
<div class="item">
<div class="title"><?php echo __("Backup Date", 'xcloner-backup-and-restore') ?>
:
</div>
<?php
echo date($date_format." ".$time_format, $latest_backup['timestamp'] + (get_option('gmt_offset') * HOUR_IN_SECONDS))
?>
</div>
<?php else: ?>
<div class="item">
<div class="title"><?php echo __("No Backup Yet", 'xcloner-backup-and-restore') ?></div>
</div>
<?php endif ?>
</blockquote>
<div>
<h5><?php echo __("Backup Storage Usage", 'xcloner-backup-and-restore') ?></h5>
<blockquote>
<div class="item">
<div class="title"><?php echo __("Total Size", 'xcloner-backup-and-restore') ?>
:
</div>
<?php echo size_format($xcloner_file_system->get_storage_usage()); ?>
</div>
</blockquote>
<h5><?php echo __("Next Scheduled Backup", 'xcloner-backup-and-restore') ?></h5>
<blockquote>
<div class="item">
<?php
$list = ($xcloner_scheduler->get_next_run_schedule());
if (is_array($list)) {
$xcloner_file_system->sort_by($list, "next_run_time", "asc");
}
if (isset($list[0])) {
$latest_schedule = $list[0];
}
?>
<?php if (isset($latest_schedule->name)): ?>
<div class="title"><?php echo __("Schedule Name", 'xcloner-backup-and-restore') ?>
:
</div>
<?php echo $latest_schedule->name; ?>
<?php endif; ?>
</div>
<div class="item">
<div class="title"><?php echo __("Next Call", 'xcloner-backup-and-restore') ?>
:
</div>
<?php if (isset($latest_schedule->next_run_time)) {
echo date($date_format." ".$time_format, $latest_schedule->next_run_time);
} else {
echo __("Unscheduled", 'xcloner-backup-and-restore');
}
?>
</div>
</blockquote>
</div>
</div>
</li>
<?php if ($xcloner_settings->get_xcloner_option('xcloner_enable_log')) : ?>
<li class="active">
<div class="collapsible-header active">
<i class="material-icons">bug_report</i><?php echo __('XCloner Debugger', 'xcloner-backup-and-restore') ?>
<div class="right">
<a href="#<?php echo $logger_basename = basename($logger->get_main_logger_url()) ?>"
class="download-logger" title="<?php echo $logger_basename ?>">
<span class="shorten_string"><?php echo $logger_basename ?> </span>
</a>
</div>
</div>
<div class="collapsible-body">
<div class="console" id="xcloner-console"><?php if ($logger_content) {
echo implode("<br />\n", array_reverse($logger_content));
} ?></div>
</div>
</li>
<script>
jQuery(document).ready(function () {
var objDiv = document.getElementById("xcloner-console");
objDiv.scrollTop = objDiv.scrollHeight;
/*setInterval(function(){
getXclonerLog();
}, 2000);*/
})
</script>
<?php endif; ?>
</ul>
</div>
</div>
<div class="col s12 m12 l5">
<div class="card blue-grey darken-1 z-depth-4 backup-ready">
<div class="card-content white-text">
<span class="card-title"><?php echo __("System Check", 'xcloner-backup-and-restore') ?></span>
<ul>
<li class="card-panel <?php echo($requirements->check_xcloner_start_path(1) ? "teal" : "red") ?> lighten-2">
<?php echo __('Backup Start Location', 'xcloner-backup-and-restore') ?>: <span
class="shorten_string "><?php echo $requirements->check_xcloner_start_path(); ?></span>
</li>
<li class="card-panel <?php echo($requirements->check_xcloner_store_path(1) ? "teal" : "red") ?> lighten-2">
<?php echo __('Backup Storage Location', 'xcloner-backup-and-restore') ?>: <span
class="shorten_string"><?php echo $requirements->check_xcloner_store_path(); ?></span>
</li>
<li class="card-panel <?php echo($requirements->check_xcloner_tmp_path(1) ? "teal" : "red") ?> lighten-2">
<?php echo __('Temporary Location', 'xcloner-backup-and-restore') ?>: <span
class="shorten_string"><?php echo $requirements->check_xcloner_tmp_path(); ?></span>
</li>
<li class="card-panel <?php echo($requirements->check_min_php_version(1) ? "teal" : "red") ?> lighten-2">
<?php echo __('PHP Version Check', 'xcloner-backup-and-restore') ?>
: <?php echo $requirements->check_min_php_version(); ?>
( >= <?php echo $requirements->get_constant('min_php_version') ?>)
</li>
<li class="card-panel <?php echo($requirements->check_safe_mode(1) ? "teal" : "orange") ?> lighten-2">
<?php echo __('PHP Safe Mode', 'xcloner-backup-and-restore') ?>
: <?php echo $requirements->check_safe_mode(); ?>
( <?php echo $requirements->get_constant('safe_mode') ?>)
</li>
<li class="card-panel <?php echo($requirements->check_backup_ready_status() ? "teal" : "red") ?> lighten-2">
<?php echo($requirements->check_backup_ready_status() ? __('BACKUP READY', 'xcloner-backup-and-restore') : __('Backup not ready, please check above requirements', 'xcloner-backup-and-restore')) ?>
<i class="material-icons right tiny"><?php echo($requirements->check_backup_ready_status() ? 'thumb_up' : 'thumb_down') ?></i>
</li>
</ul>
<ul class="additional_system_info">
<li class="card-panel grey darken-1">
<?php echo __('PHP max_execution_time', 'xcloner-backup-and-restore') ?>
: <?php echo $requirements->get_max_execution_time(); ?>
</li>
<li class="card-panel grey darken-1">
<?php echo __('PHP memory_limit', 'xcloner-backup-and-restore') ?>
: <?php echo $requirements->get_memory_limit(); ?>
</li>
<li class="card-panel grey darken-1">
<?php echo __('PHP open_basedir', 'xcloner-backup-and-restore') ?>
: <?php echo $requirements->get_open_basedir(); ?>
</li>
<?php
$data = array();
if ($requirements->check_backup_ready_status()) {
$data = $xcloner_file_system->estimate_read_write_time();
}
?>
<li class="card-panel grey darken-1">
<?php echo __('Reading Time 1MB Block', 'xcloner-backup-and-restore') ?>
: <?php echo(isset($data['reading_time']) ? $data['reading_time'] : __("unknown")); ?>
</li>
<li class="card-panel grey darken-1">
<?php echo __('Writing Time 1MB Block', 'xcloner-backup-and-restore') ?>
: <?php echo(isset($data['writing_time']) ? $data['writing_time'] : __("unknown")); ?>
</li>
<li class="card-panel grey darken-1">
<?php echo __('Free Disk Space', 'xcloner-backup-and-restore') ?>
: <?php echo $requirements->get_free_disk_space(); ; ?>
</li>
</ul>
</div>
<div class="card-action">
<a class="waves-effect waves-light btn system_info_toggle blue darken-1"><i class="material-icons left">list</i><?php echo __('Toggle Additional System Info', 'xcloner-backup-and-restore') ?>
</a>
</div>
</div>
</div>
</div>
| gpl-2.0 |
livehq/web | Gruntfile.js | 12528 | // Generated on 2014-01-17 using generator-angular 0.7.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Adds jade support
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-ng-constant');
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
yeoman: {
// configurable paths
app: require('./bower.json').appPath || 'app',
dist: 'dist'
},
// Watches files for changes and runs tasks based on the changed files
watch: {
jade: {
files: ['<%= yeoman.app %>/*.jade', '<%= yeoman.app %>/views/{,*/}*.jade'],
tasks: ['jade:dist']
},
coffee: {
files: ['<%= yeoman.app %>/scripts/**/{,*/}*.{coffee,litcoffee,coffee.md}'],
tasks: ['newer:coffee:dist']
},
coffeeTest: {
files: ['test/spec/{,*/}*.{coffee,litcoffee,coffee.md}'],
tasks: ['newer:coffee:test', 'karma']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer']
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'.tmp/scripts/{,*/}*.js',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
// The actual grunt server settings
connect: {
options: {
// Modrewrite rule, connect.static(path) for each path in target's base
middleware: function (connect, options) {
var optBase = (typeof options.base === 'string') ? [options.base] : options.base;
return [require('connect-modrewrite')(['!(\\..+)$ / [L]'])].concat(
optBase.map(function(path){ return connect.static(path); }));
},
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= yeoman.app %>'
]
}
},
test: {
options: {
port: 9001,
base: [
'.tmp',
'test',
'<%= yeoman.app %>'
]
}
},
dist: {
options: {
base: '<%= yeoman.dist %>'
}
}
},
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js'
]
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/*',
'!<%= yeoman.dist %>/.git*'
]
}]
},
server: '.tmp'
},
// Add vendor prefixed styles
autoprefixer: {
options: {
browsers: ['last 1 version']
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Note I am not using this for now since I am using jade
// Automatically inject Bower components into the app
'bower-install': {
app: {
html: '<%= yeoman.app %>/index.html',
ignorePath: '<%= yeoman.app %>/'
}
},
// Compiles CoffeeScript to JavaScript
coffee: {
options: {
sourceMap: true,
sourceRoot: ''
},
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/scripts',
src: '**/{,*/}*.coffee',
dest: '.tmp/scripts',
ext: '.js'
}]
},
test: {
files: [{
expand: true,
cwd: 'test/spec',
src: '{,*/}*.coffee',
dest: '.tmp/spec',
ext: '.js'
}]
}
},
// Compiles jade
jade: {
dist: {
options: {
pretty: true
},
files: [
{
expand: true,
cwd: '<%= yeoman.app %>/views',
src: '{,*/}*.jade',
dest: '.tmp/views',
ext: '.html'
},
{
expand: true,
cwd: '<%= yeoman.app %>',
src: '*.jade',
dest: '.tmp',
ext: '.html'
}
]
}
},
// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: '<%= yeoman.app %>/bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
debugInfo: true
}
}
},
// Renames files for browser caching purposes
rev: {
dist: {
files: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>'
}
},
// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: ['<%= yeoman.dist %>']
}
},
// The following *-min tasks produce minified files in the dist folder
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true,
removeOptionalTags: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html', 'views/{,*/}*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
// Allow the use of non-minsafe AngularJS files. Automatically makes it
// minsafe compatible so Uglify does not destroy the ng references
ngmin: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
// Replace Google CDN references
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'views/{,*/}*.html',
'bower_components/**/*',
'images/{,*/}*.{webp}',
'fonts/*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// A cool way of managing environments taken from:
// http://stackoverflow.com/questions/16339595/angular-js-configuration-for-different-enviroments
ngconstant: {
options: {
space: ' '
},
// targets
development: [
{
dest: '.tmp/scripts/config.js',
// dest: '<%= yeoman.app %>/scripts/config.js',
wrap: '"use strict";\n\n <%= __ngModule %>',
name: 'config',
constants: {
ENV: 'development'
}
}
],
production: [
{
// dest: '<%= yeoman.app %>/scripts/config.js',
dest: '<%= yeoman.dist %>/scripts/config.js',
wrap: '"use strict";\n\n <%= __ngModule %>',
name: 'config',
constants: {
ENV: 'production'
}
}
]
},
// Run some tasks in parallel to speed up the build process
concurrent: {
server: [
'coffee:dist',
'jade:dist',
'compass:server'
],
test: [
'coffee',
'jade',
'compass'
],
dist: [
'coffee',
'jade',
'compass:dist',
'imagemin',
'svgmin'
]
},
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css',
// '<%= yeoman.app %>/styles/{,*/}*.css'
// ]
// }
// }
// },
// uglify: {
// dist: {
// files: {
// '<%= yeoman.dist %>/scripts/scripts.js': [
// '<%= yeoman.dist %>/scripts/scripts.js'
// ]
// }
// }
// },
// concat: {
// dist: {}
// },
// Test settings
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('serve', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'ngconstant:development',
// 'bower-install',
'concurrent:server',
'autoprefixer',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', function () {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve']);
});
grunt.registerTask('test', [
'clean:server',
'concurrent:test',
'autoprefixer',
'connect:test',
'karma'
]);
grunt.registerTask('build', [
'clean:dist',
'ngconstant:production',
// 'bower-install',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'ngmin',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'rev',
'usemin',
'htmlmin'
]);
grunt.registerTask('default', [
'newer:jshint',
'test',
'build'
]);
};
| gpl-2.0 |
pawohl/studip | app/controllers/admin/studycourse.php | 9932 | <?php
# Lifter010: TODO
/**
* studycourse.php - controller class for the studycourses
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* @author Nico Müller <nico.mueller@uni-oldenburg.de>
* @author Michael Riehemann <michael.riehemann@uni-oldenburg.de>
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
* @package studycourses
* @since 2.0
*/
require_once 'app/controllers/authenticated_controller.php';
require_once 'app/models/studycourse.php';
/**
*
*
*/
class Admin_StudycourseController extends AuthenticatedController
{
/**
* Common tasks for all actions.
*/
public function before_filter(&$action, &$args)
{
global $perm;
parent::before_filter($action, $args);
// user must have root permission
$perm->check('root');
// set navigation
Navigation::activateItem('/admin/locations/studycourse');
}
/**
* Maintenance view for profession with the degrees
*/
public function profession_action()
{
//set title
PageLayout::setTitle(_('Verwaltung der Studiengänge'));
//get data
$this->studycourses = StudycourseModel::getStudyCourses();
$this->infobox = $this->setSidebar();
//sorting
if(Request::get('sortby') == 'users') {
usort($this->studycourses, array('Admin_StudycourseController', 'sortByUsers'));
} elseif (Request::get('sortby') == 'seminars') {
usort($this->studycourses, array('Admin_StudycourseController', 'sortBySeminars'));
}
}
/**
* Maintenance view for degrees with the professions
*/
public function degree_action()
{
// set title
PageLayout::setTitle(_('Gruppierung von Studienabschlüssen'));
//get data
$this->studydegrees = StudycourseModel::getStudyDegrees();
$this->infobox = $this->setSidebar();
//sorting
if(Request::get('sortby') == 'users') {
usort($this->studydegrees, array('Admin_StudycourseController', 'sortByUsers'));
}
}
/**
* Edit the selected profession
* @param $prof_id
*/
public function edit_profession_action($prof_id)
{
//save changes
if (Request::submitted('uebernehmen')) {
if (Request::get('professionname')) {
$prof_name = Request::get('professionname');
$prof_desc = Request::get('description');
StudycourseModel::saveEditProfession($prof_id, $prof_name, $prof_desc);
$this->flash['success'] = sprintf(_('Das Studienfach "%s" wurde erfolgreich aktualisiert!'), htmlReady($prof_name));
$this->flash['success_detail'] = array(_("Beschreibung: ") . htmlReady($prof_desc));
$this->redirect('admin/studycourse/profession');
} else {
$this->flash['error'] = _("Bitte geben Sie mindestens einen Namen für das Fach ein!");
}
}
PageLayout::setTitle(_("Fächer editieren"));
$this->edit = StudycourseModel::getStudyCourseInfo($prof_id);
$this->infobox = $this->setSidebar();
}
/**
* Edit the selected degree
* @param $deg_id
*/
public function edit_degree_action($deg_id)
{
if (Request::submitted('uebernehmen')) {
if (Request::get('degreename')) {
$deg_name = Request::get('degreename');
$deg_desc = Request::get('description');
StudycourseModel::saveEditDegree($deg_id, $deg_name, $deg_desc);
$this->flash['success'] = sprintf(_('Der Abschluss "%s" wurde erfolgreich aktualisiert!'), htmlReady($deg_name));
$this->flash['success_detail'] = array(_("Beschreibung: ") . htmlReady($deg_desc));
$this->redirect('admin/studycourse/degree');
} else {
$this->flash['error'] = _("Bitte geben Sie mindestens einen Namen für den Abschluss ein!");
}
}
PageLayout::setTitle(_("Abschlüsse editieren"));
$this->edit = StudycourseModel::getStudyDegreeInfo($deg_id);
$this->infobox = $this->setSidebar();
}
/**
* Delete a profession
* Only if count_user=0
*
* @param string $prof_id
*/
function delete_profession_action($prof_id)
{
if (Request::int('delete') == 1) {
$profession = StudycourseModel::getStudyCourses($prof_id);
//Check ob studiengang leer ist
if ($profession[0]['count_user'] == 0) {
if (StudycourseModel::deleteStudyCourse($prof_id)) {
$this->flash['success'] = _("Der Studiengang wurde erfolgreich gelöscht!");
} else {
$this->flash['error'] = _("Interner Fehler im Löschvorgang! Bitte probieren Sie es erneut.");
}
} else {
$this->flash['error']=_("Zu löschende Studiengänge müssen leer sein!");
}
} elseif (!Request::get('back')) {
$this->flash['delete'] = StudycourseModel::getStudyCourses($prof_id);
}
$this->redirect('admin/studycourse/profession');
}
/**
* Delete a degree
* Only if count_user = 0
*
* @param string $deg_id
*/
function delete_degree_action($deg_id)
{
if (Request::int('delete') == 1) {
$degree = StudycourseModel::getStudyDegrees($deg_id);
//Check ob Abschluss leer ist
if ($degree[0][count_user] == 0) {
if (StudycourseModel::deleteStudyDegree($deg_id)) {
$this->flash['success'] = _("Der Abschluss wurde erfolgreich gelöscht!");
} else {
$this->flash['error'] = _("Interner Fehler im Löschvorgang! Bitte probieren Sie es erneut.");
}
} else {
$this->flash['error'] = _("Zu löschende Abschlüsse müssen leer sein!");
}
} elseif (!Request::get('back')) {
$this->flash['delete'] = StudycourseModel::getStudyDegrees($deg_id);
}
$this->redirect('admin/studycourse/degree');
}
/**
* Create a new profession
*/
function newprofession_action()
{
if (Request::submitted('anlegen')) {
if (Request::get('professionname')) {
$prof_name = Request::get('professionname');
$prof_desc = Request::get('description');
if (!StudycourseModel::checkProfession($prof_name)) {
StudycourseModel::saveNewProfession($prof_name, $prof_desc);
$this->flash['success'] = sprintf(_('Das Studienfach "%s" wurde erfolgreich angelegt!'), htmlReady($prof_name));
$this->redirect('admin/studycourse/profession');
} else {
$this->flash['error'] = sprintf(_('Ein Studienfach mit dem Namen "%s" existiert bereits!'), htmlReady($prof_name));
}
} else {
$this->flash['error'] = _("Bitte geben Sie eine mindestens einen Namen für das Fach ein!");
}
}
PageLayout::setTitle(_("Anlegen von Studienfächern"));
$this->infobox = $this->setSidebar();
}
/**
* Create a new degree
*/
function newdegree_action()
{
if (Request::submitted('anlegen')) {
if (Request::get('degreename')) {
$deg_name = Request::get('degreename');
$deg_desc = Request::get('description');
if (!StudycourseModel::checkDegree($deg_name)) {
StudycourseModel::saveNewDegree($deg_name, $deg_desc);
$this->flash['success'] = sprintf(_('Der Studienabschluss "%s" wurde erfolgreich angelegt!'), htmlReady($deg_name));
$this->redirect('admin/studycourse/degree');
} else {
$this->flash['error'] = sprintf(_('Ein Studienabschluss mit dem Namen "%s" existiert bereits!'), htmlReady($deg_name));
}
} else {
$this->flash['error'] = _("Bitte geben Sie mindestens einen Namen für den Abschluss ein!");
}
}
PageLayout::setTitle(_("Anlegen von Studienabschlüssen"));
$this->infobox = $this->setSidebar();
}
/**
* Create the messagebox
*/
private function setSidebar()
{
$sidebar = Sidebar::Get();
$sidebar->setTitle(_('Studiengänge'));
$sidebar->setImage('sidebar/admin-sidebar.png');
$links = new ActionsWidget();
$links->addLink(_('Gruppierung nach Fächer'), $this->url_for('admin/studycourse/profession'), 'icons/16/blue/visibility-visible.png');
$links->addLink(_('Gruppierung nach Abschlüssen'), $this->url_for('admin/studycourse/degree'), 'icons/16/blue/visibility-visible.png');
$links->addLink(_('Neue Fächer anlegen'), $this->url_for('admin/studycourse/newprofession'), 'icons/16/blue/add.png');
$links->addLink(_('Neue Abschlüsse anlegen'), $this->url_for('admin/studycourse/newdegree'), 'icons/16/blue/add.png');
$sidebar->addWidget($links);
}
private static function sortByUsers($a, $b)
{
if ($a['count_user'] == $b['count_user']) {
return 0;
}
return ($a['count_user'] > $b['count_user']) ? -1 : 1;
}
private static function sortBySeminars($a, $b)
{
if ($a['count_sem'] == $b['count_sem']) {
return 0;
}
return ($a['count_sem'] > $b['count_sem']) ? -1 : 1;
}
}
| gpl-2.0 |
rolandinsh/buddypress | bp-activity/js/mentions.js | 8141 | /* global bp */
window.bp = window.bp || {};
( function( bp, $, undefined ) {
var mentionsQueryCache = [],
mentionsItem;
bp.mentions = bp.mentions || {};
bp.mentions.users = window.bp.mentions.users || [];
if ( typeof window.BP_Suggestions === 'object' ) {
bp.mentions.users = window.BP_Suggestions.friends || bp.mentions.users;
}
/**
* Adds BuddyPress @mentions to form inputs.
*
* @param {array|object} options If array, becomes the suggestions' data source. If object, passed as config to $.atwho().
* @since 2.1.0
*/
$.fn.bp_mentions = function( options ) {
if ( $.isArray( options ) ) {
options = { data: options };
}
/**
* Default options for at.js; see https://github.com/ichord/At.js/.
*/
var suggestionsDefaults = {
delay: 200,
hideWithoutSuffix: true,
insertTpl: '@${ID}',
limit: 10,
startWithSpace: false,
suffix: '',
callbacks: {
/**
* Custom filter to only match the start of spaced words.
* Based on the core/default one.
*
* @param {string} query
* @param {array} data
* @param {string} search_key
* @return {array}
* @since 2.1.0
*/
filter: function( query, data, search_key ) {
var item, _i, _len, _results = [],
regxp = new RegExp( '^' + query + '| ' + query, 'ig' ); // start of string, or preceded by a space.
for ( _i = 0, _len = data.length; _i < _len; _i++ ) {
item = data[ _i ];
if ( item[ search_key ].toLowerCase().match( regxp ) ) {
_results.push( item );
}
}
return _results;
},
/**
* Removes some spaces around highlighted string and tweaks regex to allow spaces
* (to match display_name). Based on the core default.
*
* @param {unknown} li
* @param {string} query
* @return {string}
* @since 2.1.0
*/
highlighter: function( li, query ) {
if ( ! query ) {
return li;
}
var regexp = new RegExp( '>(\\s*|[\\w\\s]*)(' + this.at.replace( '+', '\\+') + '?' + query.replace( '+', '\\+' ) + ')([\\w ]*)\\s*<', 'ig' );
return li.replace( regexp, function( str, $1, $2, $3 ) {
return '>' + $1 + '<strong>' + $2 + '</strong>' + $3 + '<';
});
},
/**
* Reposition the suggestion list dynamically.
*
* @param {unknown} offset
* @since 2.1.0
*/
before_reposition: function( offset ) {
// get the iframe, if any, already applied with atwho.js library.
var caret,
line,
iframeOffset,
move,
$view = $( '#atwho-ground-' + this.id + ' .atwho-view' ),
$body = $( 'body' ),
atwhoDataValue = this.$inputor.data( 'atwho' );
if ( 'undefined' !== atwhoDataValue && 'undefined' !== atwhoDataValue.iframe && null !== atwhoDataValue.iframe ) {
caret = this.$inputor.caret( 'offset', { iframe: atwhoDataValue.iframe } );
// Caret.js no longer calculates iframe caret position from the window (it's now just within the iframe).
// We need to get the iframe offset from the window and merge that into our object.
iframeOffset = $( atwhoDataValue.iframe ).offset();
if ( 'undefined' !== iframeOffset ) {
caret.left += iframeOffset.left;
caret.top += iframeOffset.top;
}
} else {
caret = this.$inputor.caret( 'offset' );
}
// If the caret is past horizontal half, then flip it, yo.
if ( caret.left > ( $body.width() / 2 ) ) {
$view.addClass( 'right' );
move = caret.left - offset.left - this.view.$el.width();
} else {
$view.removeClass( 'right' );
move = caret.left - offset.left + 1;
}
// If we're on a small screen, scroll to caret.
if ( $body.width() <= 400 ) {
$( document ).scrollTop( caret.top - 6 );
}
// New position is under the caret (never above) and positioned to follow.
// Dynamic sizing based on the input area (remove 'px' from end).
line = parseInt( this.$inputor.css( 'line-height' ).substr( 0, this.$inputor.css( 'line-height' ).length - 2 ), 10 );
if ( !line || line < 5 ) { // Sanity check, and catch no line-height.
line = 19;
}
offset.top = caret.top + line;
offset.left += move;
},
/**
* Override default behavior which inserts junk tags in the WordPress Visual editor.
*
* @param {unknown} $inputor Element which we're inserting content into.
* @param {string} content The content that will be inserted.
* @param {string} suffix Applied to the end of the content string.
* @return {string}
* @since 2.1.0
*/
inserting_wrapper: function( $inputor, content, suffix ) {
return '' + content + suffix;
}
}
},
/**
* Default options for our @mentions; see https://github.com/ichord/At.js/.
*/
mentionsDefaults = {
callbacks: {
/**
* If there are no matches for the query in this.data, then query BuddyPress.
*
* @param {string} query Partial @mention to search for.
* @param {function} render_view Render page callback function.
* @since 2.1.0
* @since 3.0.0. Renamed from "remote_filter" for at.js v1.5.4 support.
*/
remoteFilter: function( query, render_view ) {
var self = $( this ),
params = {};
mentionsItem = mentionsQueryCache[ query ];
if ( typeof mentionsItem === 'object' ) {
render_view( mentionsItem );
return;
}
if ( self.xhr ) {
self.xhr.abort();
}
params = { 'action': 'bp_get_suggestions', 'term': query, 'type': 'members' };
if ( $.isNumeric( this.$inputor.data( 'suggestions-group-id' ) ) ) {
params['group-id'] = parseInt( this.$inputor.data( 'suggestions-group-id' ), 10 );
}
self.xhr = $.getJSON( ajaxurl, params )
/**
* Success callback for the @suggestions lookup.
*
* @param {object} response Details of users matching the query.
* @since 2.1.0
*/
.done(function( response ) {
if ( ! response.success ) {
return;
}
var data = $.map( response.data,
/**
* Create a composite index to determine ordering of results;
* nicename matches will appear on top.
*
* @param {array} suggestion A suggestion's original data.
* @return {array} A suggestion's new data.
* @since 2.1.0
*/
function( suggestion ) {
suggestion.search = suggestion.search || suggestion.ID + ' ' + suggestion.name;
return suggestion;
}
);
mentionsQueryCache[ query ] = data;
render_view( data );
});
}
},
data: $.map( options.data,
/**
* Create a composite index to search against of nicename + display name.
* This will also determine ordering of results, so nicename matches will appear on top.
*
* @param {array} suggestion A suggestion's original data.
* @return {array} A suggestion's new data.
* @since 2.1.0
*/
function( suggestion ) {
suggestion.search = suggestion.search || suggestion.ID + ' ' + suggestion.name;
return suggestion;
}
),
at: '@',
searchKey: 'search',
displayTpl: '<li data-value="@${ID}"><img src="${image}" alt="" /><span class="username">@${ID}</span><small>${name}</small></li>'
},
opts = $.extend( true, {}, suggestionsDefaults, mentionsDefaults, options );
return $.fn.atwho.call( this, opts );
};
$( document ).ready(function() {
// Activity/reply, post comments, dashboard post 'text' editor.
$( '.bp-suggestions, #comments form textarea, .wp-editor-area' ).bp_mentions( bp.mentions.users );
});
bp.mentions.tinyMCEinit = function() {
if ( typeof window.tinyMCE === 'undefined' || window.tinyMCE.activeEditor === null || typeof window.tinyMCE.activeEditor === 'undefined' ) {
return;
} else {
$( window.tinyMCE.activeEditor.contentDocument.activeElement )
.atwho( 'setIframe', $( '.wp-editor-wrap iframe' )[0] )
.bp_mentions( bp.mentions.users );
}
};
})( bp, jQuery );
| gpl-2.0 |
Lynxiel/training | wp-content/themes/responsive/blog.php | 2585 | <?php
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) {
exit;
}
/**
* Blog Template
*
Template Name: Blog (full posts)
*
* @file blog.php
* @package Responsive
* @author Emil Uzelac
* @copyright 2003 - 2014 CyberChimps
* @license license.txt
* @version Release: 1.1.0
* @filesource wp-content/themes/responsive/blog.php
* @link http://codex.wordpress.org/Templates
* @since available since Release 1.0
*/
get_header();
global $more;
$more = 0;
?>
<div id="content-blog" class="<?php echo implode( ' ', responsive_get_content_classes() ); ?>">
<?php get_template_part( 'loop-header' ); ?>
<?php
global $wp_query, $paged;
if( get_query_var( 'paged' ) ) {
$paged = get_query_var( 'paged' );
} elseif( get_query_var( 'page' ) ) {
$paged = get_query_var( 'page' );
} else {
$paged = 1;
}
$blog_query = new WP_Query( array( 'post_type' => 'post', 'paged' => $paged ) );
$temp_query = $wp_query;
$wp_query = null;
$wp_query = $blog_query;
if( $blog_query->have_posts() ) :
while( $blog_query->have_posts() ) : $blog_query->the_post();
?>
<?php responsive_entry_before(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php responsive_entry_top(); ?>
<?php get_template_part( 'post-meta' ); ?>
<div class="post-entry">
<?php if( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>
<?php the_content( __( 'Read more ›', 'responsive' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="pagination">' . __( 'Pages:', 'responsive' ), 'after' => '</div>' ) ); ?>
</div><!-- end of .post-entry -->
<?php get_template_part( 'post-data' ); ?>
<?php responsive_entry_bottom(); ?>
</div><!-- end of #post-<?php the_ID(); ?> -->
<?php responsive_entry_after(); ?>
<?php
endwhile;
if( $wp_query->max_num_pages > 1 ) :
?>
<div class="navigation">
<div class="previous"><?php next_posts_link( __( '‹ Older posts', 'responsive' ), $wp_query->max_num_pages ); ?></div>
<div class="next"><?php previous_posts_link( __( 'Newer posts ›', 'responsive' ), $wp_query->max_num_pages ); ?></div>
</div><!-- end of .navigation -->
<?php
endif;
else :
get_template_part( 'loop-no-posts' );
endif;
$wp_query = $temp_query;
wp_reset_postdata();
?>
</div><!-- end of #content-blog -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
| gpl-2.0 |
xrfind/ecommerce | sites/all/themes/md_orenmode/template/panes/panels-pane--block--views-products-block-21.tpl.php | 1709 | <?php
/**
* @file panels-pane.tpl.php
* Main panel pane template
*
* Variables available:
* - $pane->type: the content type inside this pane
* - $pane->subtype: The subtype, if applicable. If a view it will be the
* view name; if a node it will be the nid, etc.
* - $title: The title of the content
* - $content: The actual content
* - $links: Any links associated with the content
* - $more: An optional 'more' link (destination only)
* - $admin_links: Administrative links associated with the content
* - $feeds: Any feed icons or associated with the content
* - $display: The complete panels display object containing all kinds of
* data including the contexts and all of the other panes being displayed.
*/
?>
<?php if ($pane_prefix): ?>
<?php print $pane_prefix; ?>
<?php endif; ?>
<div class="<?php print $classes; ?>" <?php print $id; ?> <?php print $attributes; ?>>
<?php if ($admin_links): ?>
<?php print $admin_links; ?>
<?php endif; ?>
<section class="new-arrivals _3">
<div class="container">
<?php print render($title_prefix); ?>
<?php if ($title): ?>
<div class="heading _3 text-center">
<h2 class="text-uppercase"><?php print $title; ?></h2>
</div>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php print render($content); ?>
</div>
</section>
<?php if ($links): ?>
<div class="links">
<?php print $links; ?>
</div>
<?php endif; ?>
<?php if ($more): ?>
<div class="more-link">
<?php print $more; ?>
</div>
<?php endif; ?>
</div>
<?php if ($pane_suffix): ?>
<?php print $pane_suffix; ?>
<?php endif; ?>
| gpl-2.0 |
russtx/tac | wp-content/themes/air-balloon-lite/js/dashicons-picker.js | 6562 | /*
* Dashicons Icon Picker
* http://themergency.com/dashicon-picker-jquery-plugin/
* https://github.com/bradvin/dashicons-picker
*
* Copyright 2013 Themergency.com
* Licensed under the GPLv2 license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Author: Brad Vincent (@themergency)
*/
(function($) {
$.fn.dashiconsPicker = function( options ) {
var icons = [
"menu",
"admin-site",
"dashboard",
"admin-post",
"admin-media",
"admin-links",
"admin-page",
"admin-comments",
"admin-appearance",
"admin-plugins",
"admin-users",
"admin-tools",
"admin-settings",
"admin-network",
"admin-home",
"admin-generic",
"admin-collapse",
"welcome-write-blog",
"welcome-add-page",
"welcome-view-site",
"welcome-widgets-menus",
"welcome-comments",
"welcome-learn-more",
"format-aside",
"format-image",
"format-gallery",
"format-video",
"format-status",
"format-quote",
"format-chat",
"format-audio",
"camera",
"images-alt",
"images-alt2",
"video-alt",
"video-alt2",
"video-alt3",
"media-archive",
"media-audio",
"media-code",
"media-default",
"media-document",
"media-interactive",
"media-spreadsheet",
"media-text",
"media-video",
"playlist-audio",
"playlist-video",
"image-crop",
"image-rotate-left",
"image-rotate-right",
"image-flip-vertical",
"image-flip-horizontal",
"undo",
"redo",
"editor-bold",
"editor-italic",
"editor-ul",
"editor-ol",
"editor-quote",
"editor-alignleft",
"editor-alignright",
"editor-aligncenter",
"editor-insertmore",
"editor-spellcheck",
"editor-expand",
"editor-contract",
"editor-kitchensink",
"editor-underline",
"editor-justify",
"editor-textcolor",
"editor-paste-word",
"editor-paste-text",
"editor-removeformatting",
"editor-video",
"editor-outdent",
"editor-indent",
"editor-help",
"editor-strikethrough",
"editor-unlink",
"editor-rtl",
"editor-break",
"editor-code",
"editor-paragraph",
"align-left",
"align-right",
"align-center",
"align-none",
"lock",
"calendar",
"visibility",
"post-status",
"edit",
"trash",
"external",
"arrow-up",
"arrow-down",
"arrow-right",
"arrow-left",
"arrow-up-alt",
"arrow-down-alt",
"arrow-right-alt",
"arrow-left-alt",
"arrow-up-alt2",
"arrow-down-alt2",
"arrow-right-alt2",
"arrow-left-alt2",
"sort",
"leftright",
"randomize",
"list-view",
"exerpt-view",
"external",
"randomize",
"share",
"share-alt",
"share-alt2",
"twitter",
"rss",
"email",
"email-alt",
"facebook",
"facebook-alt",
"googleplus",
"networking",
"hammer",
"art",
"migrate",
"performance",
"universal-access",
"universal-access-alt",
"tickets",
"nametag",
"clipboard",
"heart",
"megaphone",
"schedule",
"wordpress",
"wordpress-alt",
"pressthis",
"update",
"screenoptions",
"info",
"cart",
"feedback",
"cloud",
"translation",
"tag",
"category",
"archive",
"tagcloud",
"text",
"yes",
"no",
"no-alt",
"plus",
"plus-alt",
"minus",
"dismiss",
"marker",
"star-filled",
"star-half",
"star-empty",
"flag",
"location",
"location-alt",
"vault",
"shield",
"shield-alt",
"sos",
"search",
"slides",
"analytics",
"chart-pie",
"chart-bar",
"chart-line",
"chart-area",
"groups",
"businessman",
"id",
"id-alt",
"products",
"awards",
"forms",
"testimonial",
"portfolio",
"book",
"book-alt",
"download",
"upload",
"backup",
"clock",
"lightbulb",
"microphone",
"desktop",
"tablet",
"smartphone",
"smiley"
];
return this.each( function() {
var $button = $(this);
$button.on('click.dashiconsPicker', function() {
createPopup($button);
});
function createPopup($button) {
$target = $($button.data('target'));
$preview = $($button.data('preview'));
$popup = $('<div class="dashicon-picker-container"> \
<div class="dashicon-picker-control" /> \
<ul class="dashicon-picker-list" /> \
</div>')
.css({
'top': $button.offset().top,
'left': $button.offset().left
});
var $list = $popup.find('.dashicon-picker-list');
for (var i in icons) {
$list.append('<li data-icon="'+icons[i]+'"><a href="#" title="'+icons[i]+'"><span class="dashicons dashicons-'+icons[i]+'"></span></a></li>');
};
$('a', $list).click(function(e) {
e.preventDefault();
var title = $(this).attr("title");
$target.val("dashicons-"+title);
$preview.removeClass().addClass("dashicons dashicons-"+title);
removePopup();
});
var $control = $popup.find('.dashicon-picker-control');
$control.html('<a data-direction="back" href="#"><span class="dashicons dashicons-arrow-left-alt2"></span></a> \
<input type="text" class="" placeholder="Search" /> \
<a data-direction="forward" href="#"><span class="dashicons dashicons-arrow-right-alt2"></span></a>');
$('a', $control).click(function(e) {
e.preventDefault();
if ($(this).data('direction') === 'back') {
//move last 25 elements to front
$('li:gt(' + (icons.length - 26) + ')', $list).each(function() {
$(this).prependTo($list);
});
} else {
//move first 25 elements to the end
$('li:lt(25)', $list).each(function() {
$(this).appendTo($list);
});
}
});
$popup.appendTo('body').show();
$('input', $control).on('keyup', function(e) {
var search = $(this).val();
if (search === '') {
//show all again
$('li:lt(25)', $list).show();
} else {
$('li', $list).each(function() {
if ($(this).data('icon').toLowerCase().indexOf(search.toLowerCase()) !== -1) {
$(this).show();
} else {
$(this).hide();
}
});
}
});
$(document).mouseup(function (e){
if (!$popup.is(e.target) && $popup.has(e.target).length === 0) {
removePopup();
}
});
}
function removePopup(){
$(".dashicon-picker-container").remove();
}
});
}
$(function() {
$('.dashicons-picker').dashiconsPicker();
});
/* Run function after widget is added or updated */
function onFormUpdate( event, widget ) {
$('.dashicons-picker').dashiconsPicker();
}
$( document ).on( 'widget-added widget-updated', onFormUpdate );
}(jQuery)); | gpl-2.0 |
arthurtofani/acaoeducativa_mapasis | test/karma.conf.js | 2084 | // Karma configuration
// http://karma-runner.github.io/0.12/config/configuration-file.html
// Generated on 2015-06-15 using
// generator-karma 0.8.3
module.exports = function(config) {
'use strict';
config.set({
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// base path, that will be used to resolve files and exclude
basePath: '../',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-touch/angular-touch.js',
'app/scripts/**/*.js',
'test/mock/**/*.js',
'test/spec/**/*.js'
],
// list of files / patterns to exclude
exclude: [],
// web server port
port: 8080,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: [
'PhantomJS'
],
// Which plugins to enable
plugins: [
'karma-phantomjs-launcher',
'karma-jasmine'
],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,
colors: true,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// Uncomment the following lines if you are using grunt's server to run the tests
// proxies: {
// '/': 'http://localhost:9000/'
// },
// URL root prevent conflicts with the site root
// urlRoot: '_karma_'
});
};
| gpl-2.0 |
berkmancenter/lumendatabase | db/migrate/20151221185106_add_pdf_requested_to_file_uploads.rb | 144 | class AddPdfRequestedToFileUploads < ActiveRecord::Migration[4.2]
def change
add_column :file_uploads, :pdf_requested, :boolean
end
end
| gpl-2.0 |
viollarr/alab | administrator/components/com_menus/models/list.php | 19375 | <?php
/**
* @version $Id: list.php 11646 2009-03-01 19:34:56Z ian $
* @package Joomla
* @subpackage Menus
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant to the
* GNU General Public License, and as distributed it includes or is derivative
* of works licensed under the GNU General Public License or other free or open
* source software licenses. See COPYRIGHT.php for copyright notices and
* details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
/**
* @package Joomla
* @subpackage Menus
*/
class MenusModelList extends JModel
{
/** @var object JTable object */
var $_table = null;
var $_pagination = null;
/**
* Returns the internal table object
* @return JTable
*/
function &getTable()
{
if ($this->_table == null)
{
$this->_table =& JTable::getInstance( 'menu');
}
return $this->_table;
}
function &getItems()
{
global $mainframe;
static $items;
if (isset($items)) {
return $items;
}
$db =& $this->getDBO();
$menutype = $mainframe->getUserStateFromRequest( "com_menus.menutype", 'menutype', 'mainmenu', 'string' );
$filter_order = $mainframe->getUserStateFromRequest( 'com_menus.'.$menutype.'.filter_order', 'filter_order', 'm.ordering', 'cmd' );
$filter_order_Dir = $mainframe->getUserStateFromRequest( 'com_menus.'.$menutype.'.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word' );
$filter_state = $mainframe->getUserStateFromRequest( 'com_menus.'.$menutype.'.filter_state', 'filter_state', '', 'word' );
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg( 'list_limit' ), 'int' );
$limitstart = $mainframe->getUserStateFromRequest( 'com_menus.'.$menutype.'.limitstart', 'limitstart', 0, 'int' );
$levellimit = $mainframe->getUserStateFromRequest( 'com_menus.'.$menutype.'.levellimit', 'levellimit', 10, 'int' );
$search = $mainframe->getUserStateFromRequest( 'com_menus.'.$menutype.'.search', 'search', '', 'string' );
$search = JString::strtolower( $search );
$and = '';
if ( $filter_state )
{
if ( $filter_state == 'P' ) {
$and = ' AND m.published = 1';
} else if ($filter_state == 'U' ) {
$and = ' AND m.published = 0';
}
}
// just in case filter_order get's messed up
if ($filter_order) {
$orderby = ' ORDER BY '.$filter_order .' '. $filter_order_Dir .', m.parent, m.ordering';
} else {
$orderby = ' ORDER BY m.parent, m.ordering';
}
// select the records
// note, since this is a tree we have to do the limits code-side
if ($search) {
$query = 'SELECT m.id' .
' FROM #__menu AS m' .
' WHERE menutype = '.$db->Quote($menutype) .
' AND LOWER( m.name ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ) .
$and;
$db->setQuery( $query );
$search_rows = $db->loadResultArray();
}
$query = 'SELECT m.*, u.name AS editor, g.name AS groupname, c.publish_up, c.publish_down, com.name AS com_name' .
' FROM #__menu AS m' .
' LEFT JOIN #__users AS u ON u.id = m.checked_out' .
' LEFT JOIN #__groups AS g ON g.id = m.access' .
' LEFT JOIN #__content AS c ON c.id = m.componentid AND m.type = "content_typed"' .
' LEFT JOIN #__components AS com ON com.id = m.componentid AND m.type = "component"' .
' WHERE m.menutype = '.$db->Quote($menutype) .
' AND m.published != -2' .
$and .
$orderby;
$db->setQuery( $query );
$rows = $db->loadObjectList();
// establish the hierarchy of the menu
$children = array();
// first pass - collect children
foreach ($rows as $v )
{
$pt = $v->parent;
$list = @$children[$pt] ? $children[$pt] : array();
array_push( $list, $v );
$children[$pt] = $list;
}
// second pass - get an indent list of the items
$list = JHTML::_('menu.treerecurse', 0, '', array(), $children, max( 0, $levellimit-1 ) );
// eventually only pick out the searched items.
if ($search) {
$list1 = array();
foreach ($search_rows as $sid )
{
foreach ($list as $item)
{
if ($item->id == $sid) {
$list1[] = $item;
}
}
}
// replace full list with found items
$list = $list1;
}
$total = count( $list );
jimport('joomla.html.pagination');
$this->_pagination = new JPagination( $total, $limitstart, $limit );
// slice out elements based on limits
$list = array_slice( $list, $this->_pagination->limitstart, $this->_pagination->limit );
$i = 0;
$query = array();
foreach ( $list as $mitem )
{
$edit = '';
switch ( $mitem->type )
{
case 'separator':
$list[$i]->descrip = JText::_('Separator');
break;
case 'url':
$list[$i]->descrip = JText::_('URL');
break;
case 'menulink':
$list[$i]->descrip = JText::_('Menu Link');
break;
case 'component':
$list[$i]->descrip = JText::_('Component');
$query = parse_url($list[$i]->link);
$view = array();
if(isset($query['query'])) {
if(strpos($query['query'], '&') !== false)
{
$query['query'] = str_replace('&','&',$query['query']);
}
parse_str($query['query'], $view);
}
$list[$i]->view = $list[$i]->com_name;
if (isset($view['view']))
{
$list[$i]->view .= ' » '.JText::_(ucfirst($view['view']));
}
if (isset($view['layout']))
{
$list[$i]->view .= ' / '.JText::_(ucfirst($view['layout']));
}
if (isset($view['task']) && !isset($view['view']))
{
$list[$i]->view .= ' :: '.JText::_(ucfirst($view['task']));
}
break;
default:
$list[$i]->descrip = JText::_('Unknown');
break;
}
$i++;
}
$items = $list;
return $items;
}
function &getPagination()
{
if ($this->_pagination == null) {
$this->getItems();
}
return $this->_pagination;
}
/**
* Form for copying item(s) to a specific menu
*/
function getItemsFromRequest()
{
static $items;
if (isset($items)) {
return $items;
}
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
JArrayHelper::toInteger($cid);
if (count($cid) < 1) {
$this->setError(JText::_( 'Select an item to move'));
return false;
}
// Query to list the selected menu items
$db =& $this->getDBO();
$cids = implode( ',', $cid );
$query = 'SELECT `id`, `name`' .
' FROM `#__menu`' .
' WHERE `id` IN ( '.$cids.' )';
$db->setQuery( $query );
$items = $db->loadObjectList();
return $items;
}
/**
* Gets the componet table object related to this menu item
*/
function &getComponent()
{
$id = $this->_table->componentid;
$component = & JTable::getInstance( 'component');
$component->load( $id );
return $component;
}
/**
* Save the item(s) to the menu selected
*/
function copy( $items, $menu )
{
$curr =& JTable::getInstance('menu');
$itemref = array();
foreach ($items as $id)
{
$curr->load( $id );
$curr->id = NULL;
$curr->home = 0;
if ( !$curr->store() ) {
$this->setError($curr->getError());
return false;
}
$itemref[] = array($id, $curr->id);
}
foreach ($itemref as $ref)
{
$curr->load( $ref[1] );
if ($curr->parent!=0) {
$found = false;
foreach ( $itemref as $ref2 )
{
if ($curr->parent == $ref2[0]) {
$curr->parent = $ref2[1];
$found = true;
break;
} // if
}
if (!$found && $curr->menutype!=$menu) {
$curr->parent = 0;
}
}
$curr->menutype = $menu;
$curr->ordering = '9999';
$curr->home = 0;
if ( !$curr->store() ) {
$this->setError($curr->getError());
return false;
}
$curr->reorder( 'menutype = '.$this->_db->Quote($curr->menutype).' AND parent = '.(int) $curr->parent );
} // foreach
//Now, we need to rebuild sublevels...
$this->_rebuildSubLevel();
// clean cache
MenusHelper::cleanCache();
return true;
}
function move($items, $menu)
{
// Add all children to the list
foreach ($items as $id)
{
$this->_addChildren($id, $items);
}
$row =& $this->getTable();
$ordering = 1000000;
$firstroot = 0;
foreach ($items as $id) {
$row->load( $id );
// is it moved together with his parent?
$found = false;
if ($row->parent != 0) {
foreach ($items as $idx)
{
if ($idx == $row->parent) {
$found = true;
break;
} // if
}
}
if (!$found) {
$row->parent = 0;
$row->ordering = $ordering++;
if (!$firstroot) $firstroot = $row->id;
} // if
$row->menutype = $menu;
if ( !$row->store() ) {
$this->setError($row->getError());
return false;
} // if
} // foreach
if ($firstroot) {
$row->load( $firstroot );
$row->reorder( 'menutype = '.$this->_db->Quote($row->menutype).' AND parent = '.(int) $row->parent );
} // if
//Rebuild sublevel
$this->_rebuildSubLevel();
// clean cache
MenusHelper::cleanCache();
return true;
}
function toTrash($items)
{
$db =& $this->getDBO();
$nd = $db->getNullDate();
$state = -2;
$row =& $this->getTable();
$default = 0;
// Add all children to the list
foreach ($items as $id)
{
//Check if it's the default item
$row->load( $id );
if ($row->home != 1) {
$this->_addChildren($id, $items);
} else {
unset($items[$default]);
JError::raiseWarning( 'SOME_ERROR_CODE', JText::_('You cannot trash the default menu item'));
}
$default++;
}
if (!empty($items)) {
// Sent menu items to the trash
JArrayHelper::toInteger($items, array(0));
$where = ' WHERE (id = ' . implode( ' OR id = ', $items ) . ') AND home = 0';
$query = 'UPDATE #__menu' .
' SET published = '.(int) $state.', parent = 0, ordering = 0, checked_out = 0, checked_out_time = '.$db->Quote($nd) .
$where;
$db->setQuery( $query );
if (!$db->query()) {
$this->setError( $db->getErrorMsg() );
return false;
}
}
// clean cache
MenusHelper::cleanCache();
return count($items);
}
function fromTrash($items)
{
$db =& $this->getDBO();
$nd = $db->getNullDate();
$state = 0;
// Add all children to the list
foreach ($items as $id)
{
$this->_addChildren($id, $items);
}
// Sent menu items to the trash
JArrayHelper::toInteger($items, array(0));
$where = ' WHERE id = ' . implode( ' OR id = ', $items );
$query = 'UPDATE #__menu' .
' SET published = '.(int) $state.', parent = 0, ordering = 99999, checked_out = 0, checked_out_time = '.$db->Quote($nd) .
$where;
$db->setQuery( $query );
if (!$db->query()) {
$this->setError( $db->getErrorMsg() );
return false;
}
// clean cache (require helper because method can be called from com_trash)
require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'helpers'.DS.'helper.php' );
MenusHelper::cleanCache();
return count($items);
}
/**
* Set the state of selected menu items
*/
function setHome( $item )
{
$db =& $this->getDBO();
// Clear home field for all other items
$query = 'UPDATE #__menu' .
' SET home = 0' .
' WHERE 1';
$db->setQuery( $query );
if ( !$db->query() ) {
$this->setError($db->getErrorMsg());
return false;
}
// Set the given item to home
$query = 'UPDATE #__menu' .
' SET home = 1' .
' WHERE id = '.(int) $item;
$db->setQuery( $query );
if ( !$db->query() ) {
$this->setError($db->getErrorMsg());
return false;
}
// clean cache
MenusHelper::cleanCache();
return true;
}
/**
* Set the state of selected menu items
*/
function setItemState( $items, $state )
{
if(is_array($items))
{
$row =& $this->getTable();
foreach ($items as $id)
{
$row->load( $id );
if ($row->home != 1) {
$row->published = $state;
if ($state != 1) {
// Set any alias menu types to not point to unpublished menu items
$db = &$this->getDBO();
$query = 'UPDATE #__menu SET link = 0 WHERE type = \'menulink\' AND link = '.(int)$id;
$db->setQuery( $query );
if (!$db->query()) {
$this->setError( $db->getErrorMsg() );
return false;
}
}
if (!$row->check()) {
$this->setError($row->getError());
return false;
}
if (!$row->store()) {
$this->setError($row->getError());
return false;
}
} else {
JError::raiseWarning( 'SOME_ERROR_CODE', JText::_('You cannot unpublish the default menu item'));
return false;
}
}
}
// clean cache
MenusHelper::cleanCache();
return true;
}
/**
* Set the access of selected menu items
*/
function setAccess( $items, $access )
{
$row =& $this->getTable();
foreach ($items as $id)
{
$row->load( $id );
$row->access = $access;
// Set any alias menu types to not point to unpublished menu items
$db = &$this->getDBO();
$query = 'UPDATE #__menu SET link = 0 WHERE type = \'menulink\' AND access < '.(int)$access.' AND link = '.(int)$id;
$db->setQuery( $query );
if (!$db->query()) {
$this->setError( $db->getErrorMsg() );
return false;
}
if (!$row->check()) {
$this->setError($row->getError());
return false;
}
if (!$row->store()) {
$this->setError($row->getError());
return false;
}
}
// clean cache
MenusHelper::cleanCache();
return true;
}
function orderItem($item, $movement)
{
$row =& $this->getTable();
$row->load( $item );
if (!$row->move( $movement, 'menutype = '.$this->_db->Quote($row->menutype).' AND parent = '.(int) $row->parent )) {
$this->setError($row->getError());
return false;
}
// clean cache
MenusHelper::cleanCache();
return true;
}
function setOrder($items, $menutype)
{
$total = count( $items );
$row =& $this->getTable();
$groupings = array();
$order = JRequest::getVar( 'order', array(), 'post', 'array' );
JArrayHelper::toInteger($order);
// update ordering values
for( $i=0; $i < $total; $i++ ) {
$row->load( $items[$i] );
// track parents
$groupings[] = $row->parent;
if ($row->ordering != $order[$i]) {
$row->ordering = $order[$i];
if (!$row->store()) {
$this->setError($row->getError());
return false;
}
} // if
} // for
// execute updateOrder for each parent group
$groupings = array_unique( $groupings );
foreach ($groupings as $group){
$row->reorder('menutype = '.$this->_db->Quote($menutype).' AND parent = '.(int) $group.' AND published >=0');
}
// clean cache
MenusHelper::cleanCache();
return true;
}
/**
* Delete one or more menu items
* @param mixed int or array of id values
*/
function delete( $ids )
{
JArrayHelper::toInteger($ids);
if (!empty( $ids )) {
// Add all children to the list
foreach ($ids as $id)
{
$this->_addChildren($id, $ids);
}
$db = &$this->getDBO();
// Delete associated module and template mappings
$where = 'WHERE menuid = ' . implode( ' OR menuid = ', $ids );
$query = 'DELETE FROM #__modules_menu '
. $where;
$db->setQuery( $query );
if (!$db->query()) {
$this->setError( $menuTable->getErrorMsg() );
return false;
}
$query = 'DELETE FROM #__templates_menu '
. $where;
$db->setQuery( $query );
if (!$db->query()) {
$this->setError( $menuTable->getErrorMsg() );
return false;
}
// Set any alias menu types to not point to missing menu items
$query = 'UPDATE #__menu SET link = 0 WHERE type = \'menulink\' AND (link = '.implode( ' OR id = ', $ids ).')';
$db->setQuery( $query );
if (!$db->query()) {
$this->setError( $db->getErrorMsg() );
return false;
}
// Delete the menu items
$where = 'WHERE id = ' . implode( ' OR id = ', $ids );
$query = 'DELETE FROM #__menu ' . $where;
$db->setQuery( $query );
if (!$db->query()) {
$this->setError( $db->getErrorMsg() );
return false;
}
}
// clean cache
MenusHelper::cleanCache();
return true;
}
/**
* Delete menu items by type
*/
function deleteByType( $type = '' )
{
$db = &$this->getDBO();
$query = 'SELECT id' .
' FROM #__menu' .
' WHERE menutype = ' . $db->Quote( $type );
$db->setQuery( $query );
$ids = $db->loadResultArray();
if ($db->getErrorNum()) {
$this->setError( $db->getErrorMsg() );
return false;
}
return $this->delete( $ids );
}
function _addChildren($id, &$list)
{
// Initialize variables
$return = true;
// Get all rows with parent of $id
$db =& $this->getDBO();
$query = 'SELECT id' .
' FROM #__menu' .
' WHERE parent = '.(int) $id;
$db->setQuery( $query );
$rows = $db->loadObjectList();
// Make sure there aren't any errors
if ($db->getErrorNum()) {
$this->setError($db->getErrorMsg());
return false;
}
// Recursively iterate through all children... kinda messy
// TODO: Cleanup this method
foreach ($rows as $row)
{
$found = false;
foreach ($list as $idx)
{
if ($idx == $row->id) {
$found = true;
break;
}
}
if (!$found) {
$list[] = $row->id;
}
$return = $this->_addChildren($row->id, $list);
}
return $return;
}
/*
* Rebuild the sublevel field for items in the menu (if called with 2nd param = 0 or no params, it will rebuild entire menu tree's sublevel
* @param array of menu item ids to change level to
* @param int level to set the menu items to (based on parent
*/
function _rebuildSubLevel($cid = array(0), $level = 0)
{
JArrayHelper::toInteger($cid, array(0));
$db =& $this->getDBO();
$ids = implode( ',', $cid );
$cids = array();
if($level == 0) {
$query = 'UPDATE #__menu SET sublevel = 0 WHERE parent = 0';
$db->setQuery($query);
$db->query();
$query = 'SELECT id FROM #__menu WHERE parent = 0';
$db->setQuery($query);
$cids = $db->loadResultArray(0);
} else {
$query = 'UPDATE #__menu SET sublevel = '.(int) $level
.' WHERE parent IN ('.$ids.')';
$db->setQuery( $query );
$db->query();
$query = 'SELECT id FROM #__menu WHERE parent IN ('.$ids.')';
$db->setQuery( $query );
$cids = $db->loadResultArray( 0 );
}
if (!empty( $cids )) {
$this->_rebuildSubLevel( $cids, $level + 1 );
}
}
}
| gpl-2.0 |
diarmuidcwc/LuaDissectors | parse_arinc.lua | 4788 | function reverse_byte_bit_order(byte)
--note: array ordering starts from 1 in lua, so need to pass in byte + 1
local reverse = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, -- 0 - 8
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, -- 9 - 15
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, -- 16 - 23
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, -- 24 - 31
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, -- 32 - 39
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, -- 40 - 47
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, -- 48 - 55
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, -- 56 - 63
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, -- 64 - 71
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, -- 72 - 79
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, -- 80 - 87
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, -- 88 - 95
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, -- 96 - 103
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, -- 104 - 111
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, -- 112 - 119
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, -- 120 - 127
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, -- 128 - 135
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, -- 136 - 143
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, -- 144 - 151
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, -- 152 - 159
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, -- 160 - 167
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, -- 168 - 175
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, -- 176 - 183
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, -- 184 - 191
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, -- 192 - 199
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, -- 200 - 207
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, -- 208 - 215
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, -- 216 - 223
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, -- 224 - 231
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, -- 232 - 239
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, -- 240 - 247
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, -- 248 - 255
0x00
}
return reverse[byte]
end
function parse_arinc_detail(byte1,byte2,byte3,byte4) -- (message is 4 bytes)
-- Usage: parse_arinc_detail(buffer(offset,4))
--local byte1 = msgdata(0,1):uint() --/ (256*256*256))
--local byte2 = msgdata(1,1):uint() --/ (256*256) ) % 256
--local byte3 = msgdata(2,1):uint() --/ (256) ) % 256
--local byte4 = msgdata(3,1):uint() -- ) % 256
local parity = byte1 / 128
local ssm = byte1/32 % 4
local data = ((byte1 % 32) * 256 + byte2 ) * 64 + (byte3 / 4)
local sdi = byte3 % 4
local label = reverse_byte_bit_order(byte4+1)
return string.format(" Label: %03o Par:%01x SSM:%01x Data:%05x SDI:%01x", label, parity, ssm, data, sdi)
end
function arinc_raw(message) -- (message is 4 bytes)
byte1 = message(0,1):uint()
byte2 = message(1,1):uint()
byte3 = message(2,1):uint()
byte4 = message(3,1):uint()
return string.format(" %02x %02x %02x %02x",byte1, byte2, byte3, byte4)
end
----------------------------
-- ARINC429 message
----------------------------
-- declare our protocol
arinc429_generic_proto = Proto("a429", "MyARINC 429 Protocol")
-- Declare a few fields
f_a429_par = ProtoField.uint8("a429.parity", "Parity", base.DEC)
f_a429_ssm = ProtoField.uint8("a429.ssm", "SSM", base.DEC)
f_a429_sdi = ProtoField.uint16("a429.sdi", "SDI", base.DEC)
f_a429_data = ProtoField.uint16("a429.data", "Data", base.HEX)
f_a429_label = ProtoField.uint16("a429.label","Label", base.OCT)
arinc429_generic_proto.fields = {f_a429_par, f_a429_ssm, f_a429_sdi, f_a429_data, f_a429_label}
-- create a function to dissect it
function arinc429_generic_proto.dissector(buffer, pinfo ,ptree)
offset = 0
local parity = buffer(offset,1):uint() / 128
local ssm = buffer(offset,1):uint()/32 % 4
local data = ((buffer(offset,1):uint() % 32) * 256 + buffer(offset+1,1):uint() ) * 64 + (buffer(offset+2,1):uint() / 4)
local sdi = buffer(offset+2,1):uint() % 4
local label = reverse_byte_bit_order(buffer(offset+3,1):uint()+1)
-- arinc_subtree:add(buffer(offset,4), string.format(" Label: 0o%03o Par:%#01x SSM:%#01x Data:%#05x SDI:%#01x", label, parity, ssm, data, sdi))
local tree = ptree:add(arinc429_generic_proto,buffer(),"ARINC-429 Word")
tree:add(f_a429_label, buffer(offset,2), label)
tree:add(f_a429_ssm, buffer(offset,2), ssm)
tree:add(f_a429_sdi, buffer(offset,2), sdi)
tree:add(f_a429_par, buffer(offset,2), parity)
tree:add(f_a429_data, buffer(offset,2), data)
end
| gpl-2.0 |
MitchZinck/BlockJump | core/src/com/mzinck/blockjump/Constants.java | 330 | package com.mzinck.blockjump;
public class Constants {
public static final int BASE_HEIGHT = 200;
public static final int SCREEN_WIDTH = 720;
public static final int SCREEN_HEIGHT = 1280; // 1280 x 720
public static final int JUMP_LENGTH = 18;
public static final float ALPHA = 0.2F;
}
| gpl-2.0 |
BIORIMP/biorimp | BIO-RIMP/src/main/java/edu/wayne/cs/severe/redress2/entity/refactoring/opers/RefactoringType.java | 1513 | package edu.wayne.cs.severe.redress2.entity.refactoring.opers;
import java.util.HashMap;
import java.util.List;
import edu.wayne.cs.severe.redress2.entity.TypeDeclaration;
import edu.wayne.cs.severe.redress2.entity.refactoring.RefactoringParameter;
import edu.wayne.cs.severe.redress2.entity.refactoring.formulas.PredictionFormula;
import edu.wayne.cs.severe.redress2.entity.refactoring.json.JSONRefParam;
import edu.wayne.cs.severe.redress2.entity.refactoring.json.OBSERVRefParam;
import edu.wayne.cs.severe.redress2.exception.RefactoringException;
/**
* @author ojcchar
* @version 1.0
* @created 28-Mar-2014 17:27:28
*/
public abstract class RefactoringType {
List<TypeDeclaration> sysTypeDcls;
protected HashMap<String, PredictionFormula> formulas = new HashMap<String, PredictionFormula>();
public RefactoringType(List<TypeDeclaration> sysTypeDcls) {
this.sysTypeDcls = sysTypeDcls;
}
public abstract String getAcronym();
/**
*
* @param metrAcronym
*/
public PredictionFormula getPredFormula(String metrAcronym) {
return formulas.get(metrAcronym);
}
public abstract HashMap<String, List<RefactoringParameter>> getRefactoringParams(
List<JSONRefParam> jsonParams) throws RefactoringException;
//danaderp
//new method for controlling OBSERVRefParam
public abstract HashMap<String, List<RefactoringParameter>> getOBSERVRefactoringParams(
List<OBSERVRefParam> jsonParams) throws RefactoringException;
}// end RefactoringType | gpl-2.0 |
alexbevi/scummvm | backends/platform/sdl/win32/win32.cpp | 11619 | /* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#if defined(__GNUC__) && defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
// required for SHGFP_TYPE_CURRENT in shlobj.h
#define _WIN32_IE 0x500
#endif
#include <shlobj.h>
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "common/error.h"
#include "common/textconsole.h"
#include "backends/audiocd/win32/win32-audiocd.h"
#include "backends/platform/sdl/win32/win32.h"
#include "backends/platform/sdl/win32/win32-window.h"
#include "backends/platform/sdl/win32/win32_wrapper.h"
#include "backends/saves/windows/windows-saves.h"
#include "backends/fs/windows/windows-fs-factory.h"
#include "backends/taskbar/win32/win32-taskbar.h"
#include "backends/updates/win32/win32-updates.h"
#include "backends/dialogs/win32/win32-dialogs.h"
#include "common/memstream.h"
#define DEFAULT_CONFIG_FILE "scummvm.ini"
void OSystem_Win32::init() {
// Initialize File System Factory
_fsFactory = new WindowsFilesystemFactory();
// Create Win32 specific window
_window = new SdlWindow_Win32();
#if defined(USE_TASKBAR)
// Initialize taskbar manager
_taskbarManager = new Win32TaskbarManager((SdlWindow_Win32*)_window);
#endif
#if defined(USE_SYSDIALOGS)
// Initialize dialog manager
_dialogManager = new Win32DialogManager((SdlWindow_Win32*)_window);
#endif
// Invoke parent implementation of this method
OSystem_SDL::init();
}
void OSystem_Win32::initBackend() {
// Console window is enabled by default on Windows
ConfMan.registerDefault("console", true);
// Enable or disable the window console window
if (ConfMan.getBool("console")) {
if (AllocConsole()) {
freopen("CONIN$","r",stdin);
freopen("CONOUT$","w",stdout);
freopen("CONOUT$","w",stderr);
}
SetConsoleTitle("ScummVM Status Window");
} else {
FreeConsole();
}
// Create the savefile manager
if (_savefileManager == 0)
_savefileManager = new WindowsSaveFileManager();
#if defined(USE_SPARKLE)
// Initialize updates manager
_updateManager = new Win32UpdateManager();
#endif
// Invoke parent implementation of this method
OSystem_SDL::initBackend();
}
bool OSystem_Win32::hasFeature(Feature f) {
if (f == kFeatureDisplayLogFile || f == kFeatureOpenUrl)
return true;
#ifdef USE_SYSDIALOGS
if (f == kFeatureSystemBrowserDialog)
return true;
#endif
return OSystem_SDL::hasFeature(f);
}
bool OSystem_Win32::displayLogFile() {
if (_logFilePath.empty())
return false;
// Try opening the log file with the default text editor
// log files should be registered as "txtfile" by default and thus open in the default text editor
HINSTANCE shellExec = ShellExecute(NULL, NULL, _logFilePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
if ((intptr_t)shellExec > 32)
return true;
// ShellExecute with the default verb failed, try the "Open with..." dialog
PROCESS_INFORMATION processInformation;
STARTUPINFO startupInfo;
memset(&processInformation, 0, sizeof(processInformation));
memset(&startupInfo, 0, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
char cmdLine[MAX_PATH * 2]; // CreateProcess may change the contents of cmdLine
sprintf(cmdLine, "rundll32 shell32.dll,OpenAs_RunDLL %s", _logFilePath.c_str());
BOOL result = CreateProcess(NULL,
cmdLine,
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&startupInfo,
&processInformation);
if (result)
return true;
return false;
}
bool OSystem_Win32::openUrl(const Common::String &url) {
const uint64 result = (uint64)ShellExecute(0, 0, /*(wchar_t*)nativeFilePath.utf16()*/url.c_str(), 0, 0, SW_SHOWNORMAL);
// ShellExecute returns a value greater than 32 if successful
if (result <= 32) {
warning("ShellExecute failed: error = %u", result);
return false;
}
return true;
}
void OSystem_Win32::logMessage(LogMessageType::Type type, const char *message) {
OSystem_SDL::logMessage(type, message);
#if defined( USE_WINDBG )
OutputDebugString(message);
#endif
}
Common::String OSystem_Win32::getSystemLanguage() const {
#if defined(USE_DETECTLANG) && defined(USE_TRANSLATION)
// We can not use "setlocale" (at least not for MSVC builds), since it
// will return locales like: "English_USA.1252", thus we need a special
// way to determine the locale string for Win32.
char langName[9];
char ctryName[9];
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, langName, sizeof(langName)) != 0 &&
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, ctryName, sizeof(ctryName)) != 0) {
Common::String localeName = langName;
localeName += "_";
localeName += ctryName;
return localeName;
}
#endif // USE_DETECTLANG
// Falback to SDL implementation
return OSystem_SDL::getSystemLanguage();
}
Common::String OSystem_Win32::getScreenshotsPath() {
Common::String screenshotsPath = ConfMan.get("screenshotpath");
if (!screenshotsPath.empty()) {
if (!screenshotsPath.hasSuffix("\\") && !screenshotsPath.hasSuffix("/"))
screenshotsPath += "\\";
return screenshotsPath;
}
// Use the My Pictures folder.
char picturesPath[MAXPATHLEN];
if (SHGetFolderPathFunc(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK) {
warning("Unable to access My Pictures directory");
return Common::String();
}
screenshotsPath = Common::String(picturesPath) + "\\ScummVM Screenshots\\";
// If the directory already exists (as it should in most cases),
// we don't want to fail, but we need to stop on other errors (such as ERROR_PATH_NOT_FOUND)
if (!CreateDirectory(screenshotsPath.c_str(), NULL)) {
if (GetLastError() != ERROR_ALREADY_EXISTS)
error("Cannot create ScummVM Screenshots folder");
}
return screenshotsPath;
}
Common::String OSystem_Win32::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
// Use the Application Data directory of the user profile.
if (SHGetFolderPathFunc(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, configFile) == S_OK) {
strcat(configFile, "\\ScummVM");
if (!CreateDirectory(configFile, NULL)) {
if (GetLastError() != ERROR_ALREADY_EXISTS)
error("Cannot create ScummVM application data folder");
}
strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
FILE *tmp = NULL;
if ((tmp = fopen(configFile, "r")) == NULL) {
// Check windows directory
char oldConfigFile[MAXPATHLEN];
uint ret = GetWindowsDirectory(oldConfigFile, MAXPATHLEN);
if (ret == 0 || ret > MAXPATHLEN)
error("Cannot retrieve the path of the Windows directory");
strcat(oldConfigFile, "\\" DEFAULT_CONFIG_FILE);
if ((tmp = fopen(oldConfigFile, "r"))) {
strcpy(configFile, oldConfigFile);
fclose(tmp);
}
} else {
fclose(tmp);
}
} else {
warning("Unable to access application data directory");
// Check windows directory
uint ret = GetWindowsDirectory(configFile, MAXPATHLEN);
if (ret == 0 || ret > MAXPATHLEN)
error("Cannot retrieve the path of the Windows directory");
strcat(configFile, "\\" DEFAULT_CONFIG_FILE);
}
return configFile;
}
Common::WriteStream *OSystem_Win32::createLogFile() {
// Start out by resetting _logFilePath, so that in case
// of a failure, we know that no log file is open.
_logFilePath.clear();
char logFile[MAXPATHLEN];
// Use the Application Data directory of the user profile.
if (SHGetFolderPathFunc(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, logFile) == S_OK) {
strcat(logFile, "\\ScummVM");
CreateDirectory(logFile, NULL);
strcat(logFile, "\\Logs");
CreateDirectory(logFile, NULL);
strcat(logFile, "\\scummvm.log");
Common::FSNode file(logFile);
Common::WriteStream *stream = file.createWriteStream();
if (stream)
_logFilePath= logFile;
return stream;
} else {
warning("Unable to access application data directory");
return 0;
}
}
namespace {
class Win32ResourceArchive : public Common::Archive {
friend BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam);
public:
Win32ResourceArchive();
virtual bool hasFile(const Common::String &name) const;
virtual int listMembers(Common::ArchiveMemberList &list) const;
virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
private:
typedef Common::List<Common::String> FilenameList;
FilenameList _files;
};
BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam) {
if (IS_INTRESOURCE(lpszName))
return TRUE;
Win32ResourceArchive *arch = (Win32ResourceArchive *)lParam;
arch->_files.push_back(lpszName);
return TRUE;
}
Win32ResourceArchive::Win32ResourceArchive() {
EnumResourceNames(NULL, MAKEINTRESOURCE(256), &EnumResNameProc, (LONG_PTR)this);
}
bool Win32ResourceArchive::hasFile(const Common::String &name) const {
for (FilenameList::const_iterator i = _files.begin(); i != _files.end(); ++i) {
if (i->equalsIgnoreCase(name))
return true;
}
return false;
}
int Win32ResourceArchive::listMembers(Common::ArchiveMemberList &list) const {
int count = 0;
for (FilenameList::const_iterator i = _files.begin(); i != _files.end(); ++i, ++count)
list.push_back(Common::ArchiveMemberPtr(new Common::GenericArchiveMember(*i, this)));
return count;
}
const Common::ArchiveMemberPtr Win32ResourceArchive::getMember(const Common::String &name) const {
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
}
Common::SeekableReadStream *Win32ResourceArchive::createReadStreamForMember(const Common::String &name) const {
HRSRC resource = FindResource(NULL, name.c_str(), MAKEINTRESOURCE(256));
if (resource == NULL)
return 0;
HGLOBAL handle = LoadResource(NULL, resource);
if (handle == NULL)
return 0;
const byte *data = (const byte *)LockResource(handle);
if (data == NULL)
return 0;
uint32 size = SizeofResource(NULL, resource);
if (size == 0)
return 0;
return new Common::MemoryReadStream(data, size);
}
} // End of anonymous namespace
void OSystem_Win32::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
s.add("Win32Res", new Win32ResourceArchive(), priority);
OSystem_SDL::addSysArchivesToSearchSet(s, priority);
}
AudioCDManager *OSystem_Win32::createAudioCDManager() {
return createWin32AudioCDManager();
}
#endif
| gpl-2.0 |
ludo1026/mongodb | spring-data-repository/src/main/java/org/demo/domain/User.java | 1188 | package org.demo.domain;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* User
*/
@Document(collection = "users")
public class User implements Serializable {
@Id
private String login;
private String password;
private String mail;
private List<String> roles = new ArrayList<String>();
public String getLogin() {
return login;
}
public User setLogin(String login) {
this.login = login;
return this;
}
public String getPassword() {
return password;
}
public User setPassword(String password) {
this.password = password;
return this;
}
public String getMail() {
return mail;
}
public User setMail(String mail) {
this.mail = mail;
return this;
}
public List<String> getRoles() {
return roles;
}
public void setRoles(List<String> roles) {
this.roles = roles;
}
public User addRole(String role) {
this.roles.add(role);
return this;
}
}
| gpl-2.0 |
AAyare/signalr-notify- | Evoke.Rnd.Signalr/Evoke.Rnd.SignalrNotify.Api/Areas/HelpPage/HelpPageAreaRegistration.cs | 685 | using System.Web.Http;
using System.Web.Mvc;
namespace Evoke.Rnd.SignalrNotify.Api.Areas.HelpPage
{
public class HelpPageAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "HelpPage";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"HelpPage_Default",
"Help/{action}/{apiId}",
new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });
HelpPageConfig.Register(GlobalConfiguration.Configuration);
}
}
} | gpl-2.0 |
nadavkav/MoodleTAO | mod/rafl/includes/common/lib/email/Pear/Mail/sendmail.php | 6022 | <?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Chuck Hagenbuch <chuck@horde.org> |
// +----------------------------------------------------------------------+
/**
* Sendmail implementation of the PEAR Mail:: interface.
* @access public
* @package Mail
* @version $Revision: 1.11 $
*/
class Mail_sendmail extends Mail {
/**
* The location of the sendmail or sendmail wrapper binary on the
* filesystem.
* @var string
*/
var $sendmail_path = '/usr/sbin/sendmail';
/**
* Any extra command-line parameters to pass to the sendmail or
* sendmail wrapper binary.
* @var string
*/
var $sendmail_args = '';
/**
* Constructor.
*
* Instantiates a new Mail_sendmail:: object based on the parameters
* passed in. It looks for the following parameters:
* sendmail_path The location of the sendmail binary on the
* filesystem. Defaults to '/usr/sbin/sendmail'.
*
* sendmail_args Any extra parameters to pass to the sendmail
* or sendmail wrapper binary.
*
* If a parameter is present in the $params array, it replaces the
* default.
*
* @param array $params Hash containing any parameters different from the
* defaults.
* @access public
*/
function Mail_sendmail($params)
{
if (isset($params['sendmail_path'])) $this->sendmail_path = $params['sendmail_path'];
if (isset($params['sendmail_args'])) $this->sendmail_args = $params['sendmail_args'];
/*
* Because we need to pass message headers to the sendmail program on
* the commandline, we can't guarantee the use of the standard "\r\n"
* separator. Instead, we use the system's native line separator.
*/
$this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
}
/**
* Implements Mail::send() function using the sendmail
* command-line binary.
*
* @param mixed $recipients Either a comma-seperated list of recipients
* (RFC822 compliant), or an array of recipients,
* each RFC822 valid. This may contain recipients not
* specified in the headers, for Bcc:, resending
* messages, etc.
*
* @param array $headers The array of headers to send with the mail, in an
* associative array, where the array key is the
* header name (ie, 'Subject'), and the array value
* is the header value (ie, 'test'). The header
* produced from those values would be 'Subject:
* test'.
*
* @param string $body The full text of the message body, including any
* Mime parts, etc.
*
* @return mixed Returns true on success, or a PEAR_Error
* containing a descriptive error message on
* failure.
* @access public
*/
function send($recipients, $headers, $body)
{
$recipients = $this->parseRecipients($recipients);
if (PEAR::isError($recipients)) {
return $recipients;
}
$recipients = escapeShellCmd(implode(' ', $recipients));
$headerElements = $this->prepareHeaders($headers);
if (PEAR::isError($headerElements)) {
return $headerElements;
}
list($from, $text_headers) = $headerElements;
if (!isset($from)) {
return PEAR::raiseError('No from address given.');
} elseif (strpos($from, ' ') !== false ||
strpos($from, ';') !== false ||
strpos($from, '&') !== false ||
strpos($from, '`') !== false) {
return PEAR::raiseError('From address specified with dangerous characters.');
}
$result = 0;
if (@is_file($this->sendmail_path)) {
$from = escapeShellCmd($from);
$mail = popen($this->sendmail_path . (!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . " -f$from -- $recipients", 'w');
fputs($mail, $text_headers);
fputs($mail, $this->sep); // newline to end the headers section
fputs($mail, $body);
$result = pclose($mail);
if (version_compare(phpversion(), '4.2.3') == -1) {
// With older php versions, we need to shift the
// pclose result to get the exit code.
$result = $result >> 8 & 0xFF;
}
} else {
return PEAR::raiseError('sendmail [' . $this->sendmail_path . '] is not a valid file');
}
if ($result != 0) {
return PEAR::raiseError('sendmail returned error code ' . $result,
$result);
}
return true;
}
}
?> | gpl-2.0 |
jim835/qscene_ez | extension/ezfind/classes/ezfsearchresultinfo.php | 13243 | <?php
//
//
// ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
// SOFTWARE NAME: eZ Publish Community Project
// SOFTWARE RELEASE: 2012.2
// COPYRIGHT NOTICE: Copyright (C) 1999-2012 eZ Systems AS
// SOFTWARE LICENSE: GNU General Public License v2
// NOTICE: >
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2.0 of the GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of version 2.0 of the GNU General
// Public License along with this program; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
// MA 02110-1301, USA.
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
/*! \file ezfsearchresultinfo.php
*/
/**
* ezfSearchResultInfo contains additional search result information.
* This information include facet information.
*/
class ezfSearchResultInfo
{
/**
* Constructor
*
* @param array Search result information list.
* This list contains facet information, errors and
* engine information.
* Example parameter.
* <code>
* $searchResultInfo = new ezfSearchResultInfo(
* array( 'facet' => array( 'facet_fields' => array( 'facet_fields' => array( .... ) ) ),
* 'Engine' => 'engine name',
* ... )
*/
function ezfSearchResultInfo( array $resultArray )
{
$this->ResultArray = $resultArray;
}
/**
* Attribute name list.
*
* @return array List or attribute names.
*/
public function attributes()
{
return array( 'facet_fields',
'facet_queries',
'engine',
'hasError',
'error',
'responseHeader',
'spellcheck',
// spellcheck_collation is part of spellcheck suggestions,
// but a border case is present when "collation"
// is also a word searched for and not present in the
// spellcheck dictionary/index -- Solr php response writer "bug"
'spellcheck_collation' );
}
/**
* Get attribute value
*
* @param string Attribute name
*
* @return mixed Attribute value. null if attribute does not exist.
*/
public function attribute( $attr )
{
switch( $attr )
{
case 'responseHeader':
{
return $this->ResultArray['responseHeader'];
} break;
case 'hasError':
{
return !empty( $this->ResultArray['error'] );
} break;
case 'error':
{
if ( !empty( $this->ResultArray['error'] ) )
{
return $this->ResultArray['error'];
}
}
case 'facet_queries':
{
if ( !empty( $this->FacetQueries ) )
{
return $this->FacetQueries;
}
// If the facets count is empty, an error has occured.
if ( empty( $this->ResultArray['facet_counts'] ) )
{
return null;
}
$facetArray = array();
foreach ( $this->ResultArray['facet_counts']['facet_queries'] as $query => $count )
{
list( $field, $fieldValue ) = explode( ':', $query );
$fieldInfo = array( 'field' => $field,
'count' => $count,
'queryLimit' => $query,
'fieldValue' => $fieldValue );
$facetArray[] = $fieldInfo;
}
$this->FacetQueries = $facetArray;
return $this->FacetQueries;
} break;
case 'facet_fields':
{
if ( !empty( $this->FacetFields ) )
{
return $this->FacetFields;
}
// If the facets count is empty, an error has occured.
if ( empty( $this->ResultArray['facet_counts'] ) )
{
return null;
}
$facetArray = array();
foreach ( $this->ResultArray['facet_counts']['facet_fields'] as $field => $facetField )
{
switch( $field )
{
// class facet field
case eZSolr::getMetaFieldName( 'contentclass_id' ):
{
$fieldInfo = array( 'field' => 'class',
'count' => count( $facetField ),
'nameList' => array(),
'queryLimit' => array(),
'countList' => array() );
foreach ( $facetField as $contentClassID => $count )
{
if ( $contentClass = eZContentClass::fetch( $contentClassID ) )
{
$fieldInfo['nameList'][$contentClassID] = $contentClass->attribute( 'name' );
$fieldInfo['queryLimit'][$contentClassID] = 'contentclass_id:' . $contentClassID;
$fieldInfo['countList'][$contentClassID] = $count;
}
else
{
eZDebug::writeWarning( 'Could not fetch eZContentClass: ' . $contentClassID, __METHOD__ );
}
}
$facetArray[] = $fieldInfo;
} break;
// instalaltion facet field
case eZSolr::getMetaFieldName( 'installation_id' ):
{
$findINI = eZINI::instance( 'ezfind.ini' );
$siteNameMapList = $findINI->variable( 'FacetSettings', 'SiteNameList' );
$fieldInfo = array( 'field' => 'installation',
'count' => count( $facetField ),
'nameList' => array(),
'queryLimit' => array(),
'countList' => array() );
foreach ( $facetField as $installationID => $count )
{
$fieldInfo['nameList'][$installationID] = isset( $siteNameMapList[$installationID] ) ?
$siteNameMapList[$installationID] : $installationID;
$fieldInfo['queryLimit'][$installationID] = 'installation_id:' . $installationID;
$fieldInfo['countList'][$installationID] = $count;
}
$facetArray[] = $fieldInfo;
} break;
// author facet field
case eZSolr::getMetaFieldName( 'owner_id' ):
{
$fieldInfo = array( 'field' => 'author',
'count' => count( $facetField ),
'nameList' => array(),
'queryLimit' => array(),
'countList' => array() );
foreach ( $facetField as $ownerID => $count )
{
if ( $owner = eZContentObject::fetch( $ownerID ) )
{
$fieldInfo['nameList'][$ownerID] = $owner->attribute( 'name' );
$fieldInfo['queryLimit'][$ownerID] = 'owner_id:' . $ownerID;
$fieldInfo['countList'][$ownerID] = $count;
}
else
{
eZDebug::writeWarning( 'Could not fetch owner ( eZContentObject ): ' . $ownerID, __METHOD__ );
}
}
$facetArray[] = $fieldInfo;
} break;
// translation facet field
case eZSolr::getMetaFieldName( 'language_code' ):
{
$fieldInfo = array( 'field' => 'translation',
'count' => count( $facetField ),
'nameList' => array(),
'queryLimit' => array(),
'countList' => array() );
foreach ( $facetField as $languageCode => $count )
{
$fieldInfo['nameList'][$languageCode] = $languageCode;
$fieldInfo['queryLimit'][$languageCode] = 'language_code:' . $languageCode;
$fieldInfo['countList'][$languageCode] = $count;
}
$facetArray[] = $fieldInfo;
} break;
default:
{
$fieldInfo = array( 'field' => $attr,
'count' => count( $facetField ),
'queryLimit' => array(),
'nameList' => array(),
'countList' => array() );
foreach ( $facetField as $value => $count )
{
$fieldInfo['nameList'][$value] = '"' . $value . '"';
$fieldInfo['queryLimit'][$value] = $field . ':"' . $value . '"';
$fieldInfo['countList'][$value] = $count;
}
$facetArray[] = $fieldInfo;
} break;
}
}
$this->FacetFields = $facetArray;
return $this->FacetFields;
} break;
case 'engine':
{
return eZSolr::engineText();
} break;
//may or may not be active, so returns false if not present
case 'spellcheck':
{
if ( isset( $this->ResultArray['spellcheck'] ) && $this->ResultArray['spellcheck']['suggestions'] > 0 )
{
return $this->ResultArray['spellcheck']['suggestions'];
}
else
{
return false;
}
} break;
case 'spellcheck_collation':
{
if ( isset( $this->ResultArray['spellcheck']['suggestions']['collation'] ) )
{
// work around border case if 'collation' is searched for but does not exist in the spell check index
// the collation string is the last element of the suggestions array
return end( $this->ResultArray['spellcheck']['suggestions'] );
}
else
{
return false;
}
} break;
//only relevant for MoreLikeThis queries
case 'interestingTerms':
{
if ( isset( $this->ResultArray['interestingTerms'] ) )
{
return $this->ResultArray['interestingTerms'];
}
else
{
return false;
}
} break;
default:
{
} break;
}
return null;
}
/**
* Check if attribute name exists.
*
* @param string Attribute name
*
* @return boolean True if attribute name exists. False if not.
*/
public function hasAttribute( $attr )
{
return in_array( $attr, $this->attributes() );
}
/// Member vars
protected $FacetFields;
protected $FacetQueries;
protected $ResultArray;
}
?>
| gpl-2.0 |
Automattic/woocommerce-connect-client | client/extensions/woocommerce/state/sites/settings/reducer.js | 383 | /** @format */
/**
* Internal dependencies
*/
import { combineReducers } from 'state/utils';
import general from './general/reducer';
import products from './products/reducer';
import tax from './tax/reducer';
import mailchimp from './mailchimp/reducer';
import email from './email/reducer';
export default combineReducers( {
general,
products,
tax,
mailchimp,
email,
} );
| gpl-2.0 |
klst-com/metasfresh | de.metas.adempiere.adempiere/base/src/test/java/org/compiere/util/UtilTest.java | 1938 | package org.compiere.util;
import org.junit.Assert;
import org.junit.Test;
/*
* #%L
* de.metas.adempiere.adempiere.base
* %%
* Copyright (C) 2016 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
public class UtilTest
{
@Test
public void test_coalesce3()
{
final Object o1 = new Object();
final Object o2 = new Object();
final Object o3 = new Object();
test_coalesce3(o1, o1, o2, o3);
test_coalesce3(o1, null, o1, o2);
test_coalesce3(o1, null, null, o1);
test_coalesce3(null, null, null, null);
}
public <T> void test_coalesce3(final T expected, final T value1, final T value2, final T value3)
{
{
final T actual = Util.coalesce(value1, value2, value3);
Assert.assertSame(expected, actual);
}
{
final Object actual = Util.coalesce(new Object[] { value1, value2, value3 });
Assert.assertSame(expected, actual);
}
}
@Test
public void test_clearAmp()
{
test_clearAmp(null, null);
test_clearAmp("", "");
test_clearAmp("nothing", "nothing");
test_clearAmp("Springe zu Eintrag (wo verwendet)", "&Springe zu Eintrag (wo verwendet)");
}
private void test_clearAmp(final String expected, final String input)
{
final String actual = Util.cleanAmp(input);
Assert.assertEquals("Invalid result for input: "+input, expected, actual);
}
}
| gpl-2.0 |
jaredmoore/d3_examples | scatterplot/d3_pop_scatterplot.js | 6620 | // Create a plotter for population based methods. Scatterplot displays the maximum and
// average fitnesses of a population by generation.
//
// Input data is assumed to have the following format:
// [[gen,max_fitness,0],[gen,avg_fitness,1]]
var D3_Plotter = D3_Plotter || new function() {
var Generic_Scatterplot = function() {
var fitness_data = [];
var colors;
var xScale, yScale, yAxis, xAxis, svg;
// Create the scatterplot object which tracks population fitness.
this.scatterplot = function(xAxisLabel, yAxisLabel, legend, scatterplot_div, point_colors) {
var popchart = $("#pop-scatterplot-div"),
p = 30,
w = 500,
h = 300;
colors = point_colors;
//Create scale functions
xScale = d3.scale.linear()
.domain([0, d3.max(fitness_data, function(d) { return d[0]; })])
.range([p, w - p * 2]);
yScale = d3.scale.linear()
.domain([0, d3.max(fitness_data, function(d) { return d[1]; })])
.range([h - p, p]);
//Define X axis
xAxis = d3.svg.axis()
.scale(xScale)
.orient("bottom")
.ticks(5);
//Define Y axis
yAxis = d3.svg.axis()
.scale(yScale)
.orient("left")
.ticks(5);
//Create SVG element
svg = d3.select(scatterplot_div)
.append("svg")
.attr("width", w)
.attr("height", h);
//Create circles
svg.selectAll("circle")
.data(fitness_data)
.enter()
.append("circle")
.attr("cx", function(d) {
return xScale(d[0]);
})
.attr("cy", function(d) {
return yScale(d[1]);
})
.attr("r", 2)
.attr("fill", function(d) {
return colors[d[2]];
});
//Create X axis
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + (h - p) + ")")
.call(xAxis)
.append("text")
.attr("class", "label")
.attr("x", w)
.attr("y", 0)
.style("text-anchor", "end")
.text(xAxisLabel);
//Create Y axis
svg.append("g")
.attr("class", "y axis")
.attr("transform", "translate(" + p + ",0)")
.call(yAxis)
.append("text")
.attr("class", "label")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text(yAxisLabel);
if (legend) {
// draw legend
var legend = svg.selectAll(".legend")
.data([['max',colors[0]],['avg',colors[1]]])
.enter().append("g")
.attr("class", "legend")
.attr("transform", function(d, i) { return "translate(0," + i * 20 + ")"; });
// draw legend colored rectangles
legend.append("rect")
.attr("x", w - 18)
.attr("width", 18)
.attr("height", 18)
.style("fill", function(d) { return d[1]; });
// draw legend text
legend.append("text")
.attr("x", w - 24)
.attr("y", 9)
.attr("dy", ".35em")
.style("text-anchor", "end")
.text(function(d) { return d[0];})
}
}
// Update function to add new data to the scatterplot.
//
// Input data is assumed to have the following format:
// [[gen,max_fitness,0],[gen,avg_fitness,1]
this.updateScatterplot = function(new_data) {
// If new_data is empty, reset the plot.
if(!new_data) {
fitness_data = [];
} else {
for (var i = 0; i < new_data.length; ++i) {
fitness_data.push(new_data[i]);
}
}
//Update scale domains
xScale.domain([0, d3.max(fitness_data, function(d) { return Math.ceil((d[0]+1)/10)*10; })]);
yScale.domain([0, d3.max(fitness_data, function(d) { return d[1]; })]);
//Update all circles
svg.selectAll("circle")
.data(fitness_data)
.transition()
.duration(100)
.attr("cx", function(d) {
return xScale(d[0]);
})
.attr("cy", function(d) {
return yScale(d[1]);
})
.attr("fill", function(d) {
return colors[d[2]];
});
//Enter new circles
svg.selectAll("circle")
.data(fitness_data)
.enter()
.append("circle")
.attr("cx", function(d) {
return xScale(d[0]);
})
.attr("cy", function(d) {
return yScale(d[1]);
})
.attr("r", 2)
.attr("fill", function(d) {
return colors[d[2]];
});
// Remove old
svg.selectAll("circle")
.data(fitness_data)
.exit()
.remove();
// Update the axes
//Define X axis
xAxis = d3.svg.axis()
.scale(xScale)
.orient("bottom")
.ticks(5);
//Define Y axis
yAxis = d3.svg.axis()
.scale(yScale)
.orient("left")
.ticks(5);
svg.selectAll('.x.axis')
.call(xAxis);
svg.selectAll('.y.axis')
.call(yAxis);
}
// Remove data from what should be plotted on the scatterplot.
this.removeData = function(data_to_remove) {
for(var i = fitness_data.length - 1; i >= 0; --i) {
if (fitness_data[i][0] == data_to_remove[0][0] && fitness_data[i][1] == data_to_remove[0][1]) {
fitness_data.splice(i,1);
}
}
}
}
var gen_scatterplot = new Generic_Scatterplot();
var pop_scatterplot = new Generic_Scatterplot();
// Create the scatterplot object which tracks generational fitness.
this.generationalScatterplot = function() {
gen_scatterplot.scatterplot("Generation","Fitness",true,"#gen-scatterplot-div", [d3.rgb(255,0,0),d3.rgb(0,255,0)]);
}
// Update function to add new data to the generational scatterplot.
//
// Input data is assumed to have the following format:
// [[gen,max_fitness,0],[gen,avg_fitness,1]
this.updateGenerationalScatterplot = function(new_data) {
gen_scatterplot.updateScatterplot(new_data);
}
// Create the scatterplot that tracks population fitness during a generation.
this.populationScatterplot = function() {
pop_scatterplot.scatterplot("Population","Fitness",false,"#pop-scatterplot-div",[d3.rgb(0,0,255)]);
}
// Update function to add new data to the generational scatterplot.
//
// Input data is assumed to have the following format:
// [[gen,max_fitness,0],[gen,avg_fitness,1]
// old_data is an optional argument and should be passed as null if not wanted
this.updatePopulationScatterplot = function(new_data, old_data) {
if (old_data != null) {
pop_scatterplot.removeData(old_data);
}
pop_scatterplot.updateScatterplot(new_data);
}
}; | gpl-2.0 |