Browse Source

Добавлен модуль Галерея

master
commit
d23771407a
  1. 16
      README.md
  2. 1158
      class.gallery.php
  3. 4
      index.php
  4. 139
      lang/ru.txt
  5. 129
      module.php
  6. 106
      sql.php
  7. 401
      templates/admin_gallery_edit.tpl
  8. 168
      templates/admin_gallery_image.tpl
  9. 204
      templates/admin_gallery_list.tpl
  10. 128
      templates/admin_gallery_upload_form.tpl
  11. 37
      templates/admin_gallery_upload_form_finish.tpl
  12. 131
      upload.php

16
README.md

@ -0,0 +1,16 @@
## gallery
# Модуль Галерея v3.2.2
## Данный модуль предназначен для построения карты вашего сайта на основе существующих пунктов меню навигации.
* Gallery + Watermark<br />Внимание! У директорий<br />uploads/gallery/.upload/ и<br />uploads/gallery/.temp/<br />должны быть права на запись!<br /><br />
* Вы можете ограничить количество выводимых изображений, указав после Gallery-ID следующее: -3 (в этом случае количество будет ограничено тремя изображениями на страницу)
## Перед копированием модуля в папку modules, удалите файл README.md, копируйте только корневую папку gallery со всем ее содержимым внутри!
## Changelog:
01.05.2014 - версия 3.2.2

1158
class.gallery.php

File diff suppressed because it is too large Load Diff

4
index.php

@ -0,0 +1,4 @@
<?php
header('Location:/');
exit;
?>

139
lang/ru.txt

@ -0,0 +1,139 @@
NoTitle = "Без названия"
NoDescr = "Описания нет. Извините."
MoreImages = "<strong>&raquo; Ещё изображения...</strong>"
WinClose = "Закрыть окно"
[admin]
ModName = "Галерея"
ModTitle = "В данном разделе находится список всех галерей."
GalleryList = "Список галерей"
MaxImagesPage = "Количество миниатюр на странице"
Shrink = "Уменьшать изображения"
To100 = "100%"
To75 = "до 75% от оригинала"
To50 = "до 50% от оригинала"
To25 = "до 25% от оригинала"
ModSettingGal = "Общие настройки"
ModSettingGalT = "В данном разделе приведены общие настройки данной галереи."
Upload = "Добавление изображений"
UploadProg = "Обработка изображений"
Overview = "Просмотр изображений"
OverviewT = "В данном разделе приведен список изображений данной галереи."
UploadProgT = "Создаются миниатюры..."
FilePrev = "Предпросмотр"
FileTitle = "Название изображения"
FileDesc = "Описание изображения"
CheckboxCreate = "Если поставить галочку и нажать кнопку Cоздать папку, то для данной галереи создается своя папка. Все картинки принадлежащие этой галерее переместятся в данную папку."
Folder = "Папка"
CreateFolder = "Создать папки"
GalleryFolder = "Имя папки<br /><small>(латинскими буквами)</small>"
GalleryFolderP = "Имя папки"
GalleryFolderDesc = "Если вы хотите удалить персональную папку галереи и перенести все файлы галереи в папку &quot;uploads&quot;, то оставьте поле пустым"
NewGallery = "Добавить новую галерею"
GalleryTitle = "Название галереи"
FolderExists = "Такая папка уже существует"
EmptyGalleryTitle = "Укажите название галереи"
GalleryDesc = "Описание галереи"
MaxWidth = "Ширина миниатюр (в пикселях)"
MaxHeight = "Высота миниатюр (в пикселях)"
MaxImagesERow = "Количество миниатюр в строке"
MaxWidthWarn = "<b>Внимание!</b> Изменения размеров, ранее загруженных изображений, выполняется при просмотре изображений галереи в панели администратора!"
MaxHeightWarn = "<b>Внимание!</b> Изменения размеров, ранее загруженных изображений, выполняется при просмотре изображений галереи в панели администратора!"
ThumbMethod = "Метод формирования миниатюр"
Crop = "Crop"
Resize = "Resize"
GalleryAuthor = "Автор"
Gcreated = "Создана"
IName = "Название изображения"
ISelect = "Выберите изображение"
IncImages = "Изображений"
MarDel = "Отметить для удаления"
MarAllDel = "Отметить все для удаления"
MarAct = "Активно"
MarAllAct = "Отметить все"
LinknewGal = "Добавить новую галерею"
ImagesMore = "Загрузить изображения в галерею"
GalView = "Вернуться к списку галерей"
CpTag = "Тег в системе"
AddnewImages = "Добавить изображения"
EditGallery = "Редактировать галерею"
DeleteGallery = "Удалить галерею"
UploadInfo = "Пожалуйста, используйте только следующие типы файлов:"
DeleteGalleryC = "Вы уверены, что хотите удалить данную галерею?"
MoreInfos = "Дополнительная информация"
Filesize = "Размер файла"
Filename = "Имя файла"
Uploader = "Опубликовал"
UploadOn = "Дата загрузки"
Showdescr = "Показывать описание изображения"
ShowSize = "Показывать размер изображения"
ShowHeader = "Показывать название изображения"
TypeOut = "Тип вывода изображений"
TypeOut1 = "Только миниатюры"
TypeOut2 = "PopUp"
TypeOut3 = "LightBox"
TypeOut4 = "LightView"
TypeOut5 = "Sexy Lightbox"
TypeOut6 = "Highslide"
TypeOut7 = "Настраиваемый тип"
ErrorFolderStart = "<h2>Ошибка!</h2><br /><br /><b>Директория &quot;"
ErrorFolderEnd = "&quot; отсутствует или имеет права только для чтения.<br />Необходимо создать дирректорию и/или установить права доступа (Unix: chmod 777)</b>"
Watermark = "Имя Watermark-файла"
ButtonSave = "Сохранить"
ButtonSaveEdit = "Сохранить и продолжить редактировать"
ButtonAdd = "Добавить"
DateFormat = "%d-%m-%Y г. в %H:%M"
Actions = "Действия"
LoadFromFolder = "Загрузить из папки /temp/"
Position = "Позиция"
ImageView = "Просмотр изображений"
UserProfile = "Учетная запись пользователя"
MaxSize = "Максимальный размер"
OrderImage = "Порядок сортировки"
OrderPosition = "по позиции"
OrderDateAsc = "по дате"
OrderDateDesc = "по дате в обратном порядке"
OrderTitleAsc = "по названию"
OrderTitleDesc = "по названию в обратном порядке"
GalleryScripts = "Основной шаблон оформления галереи"
ImageTpl = "Шаблон вывода изображения"
GalleryScriptsTag = "Системные теги шаблона скриптов"
ImageTplTag = "Системные теги шаблона изображения"
GalleryTagId = "Системный тег идентификатора галереи"
GalleryTagFolder = "Системный тег имени папки галереи"
GalleryTagImgId = "Системный тег идентификатора изображения"
GalleryTagImgTitle = "Системный тег названия изображения"
GalleryTagImgDesc = "Системный тег описания изображения"
GalleryTagImgFilename = "Системный тег имени файла изображения"
GalleryTagImgThumb = "Системный тег миниатюры изображения"
GalleryTagTitl = "Системный тег названия галереи"
GalleryTagDesc = "Системный тег описания галереи"
GalleryTagPath = "Системный тег определяющий корень установки"
GalleryTagLink = "Ссылка на документ"
GalleryTags = "HTML tags"
GalleryIfElse = "Условия"
GallerySample = "Пример"
GallerySample1 = "четный"
GallerySample2 = "нечетный"
GallerySetParam = "Параметр"
GallerySetVal = "Значение"
GalleryTagContent = "Системный тег отвечающий за вывод элементов галереи, указанных в поле «Шаблон вывода изображения»"
GalleryTagPages = "Системный тег отвечающий за вывод постраничной навигации для галереи (< 1 2 3 >)"
GalleryTagImgSize = "Системный тег размера файла изображения (Kb)"
GallerySeppLine = "То, что будет выводится после N миниатюр в строке (см. «Количество миниатюр в строке»)"
GalleryMediaPath = "Системный тег определяющий путь до папки с шаблоном<br /><strong>Например:</strong><br />[tag:mediapath]images/logo.gif"
GalleryCopy = "Копировать галерею"
GalleryCopyT = "Пожалуйста, укажите название галереи."
CopyGallery = "Копировать галерею"
GallerryNoItems = "В настоящий момент не существует ни одной галереи."
SavedOk = "Настройки успешно сохранены"
Or = "&nbsp;или&nbsp;"
LinkToDoc = "Связать с существующим документом"
LinkDoc = "Ссылка на документ"
GalleryReportCopy = "Создал копию галерии"

129
module.php

@ -0,0 +1,129 @@
<?php
/**
* AVE.cms - Модуль Галерея
*
* @package AVE.cms
* @subpackage module_Gallery
* @filesource
*/
if(!defined('BASE_DIR')) exit;
if (defined('ACP'))
{
$modul['ModuleName'] = 'Галерея';
$modul['ModuleSysName'] = 'gallery';
$modul['ModuleVersion'] = '3.2.2';
$modul['ModuleDescription'] = 'Gallery + Watermark<br />Внимание! У директорий<br />uploads/gallery/.upload/ и<br />uploads/gallery/.temp/<br />должны быть права на запись!<br /><br />Вы можете ограничить количество выводимых изображений, указав после Gallery-ID следующее: -3 (в этом случае количество будет ограничено тремя изображениями на страницу)';
$modul['ModuleAutor'] = 'AVE.CMS Team';
$modul['ModuleCopyright'] = '&copy; 2007-2013 AVE.CMS';
$modul['ModuleIsFunction'] = 1;
$modul['ModuleAdminEdit'] = 1;
$modul['ModuleFunction'] = 'mod_gallery';
$modul['ModuleTag'] = '[mod_gallery:XXX-Лимит]';
$modul['ModuleTagLink'] = null;
$modul['ModuleAveTag'] = '#\\\[mod_gallery:([\\\d-]+)]#';
$modul['ModulePHPTag'] = "<?php mod_gallery(''$1''); ?>";
}
/**
* Функция вывода галереи
*
* @param string $gallery_id идентификатор галереи
* и опционально количество изображений на странице
*/
function mod_gallery($gallery_id)
{
global $AVE_Template;
require_once(BASE_DIR . '/modules/gallery/class.gallery.php');
$gallery = new Gallery;
$own_lim = @explode('-', stripslashes($gallery_id));
$lim = (empty($own_lim[1])) ? '' : $own_lim[1];
$gallery_id = $own_lim[0];
$tpl_dir = BASE_DIR . '/modules/gallery/templates/';
$lang_file = BASE_DIR . '/modules/gallery/lang/' . $_SESSION['user_language'] . '.txt';
$AVE_Template->config_load($lang_file);
$gallery->galleryShow($tpl_dir, $gallery_id, $lim);
}
if (!defined('ACP') && isset($_REQUEST['module']) && $_REQUEST['module'] == 'gallery')
{
require_once(BASE_DIR . '/modules/gallery/class.gallery.php');
$gallery = new Gallery;
$tpl_dir = BASE_DIR . '/modules/gallery/templates/';
$lang_file = BASE_DIR . '/modules/gallery/lang/' . $_SESSION['user_language'] . '.txt';
$AVE_Template->config_load($lang_file);
define('ONLYCONTENT', 1);
if (isset($_REQUEST['sub']) && $_REQUEST['sub'] == 'allimages')
{
$AVE_Template->assign('tpl_dir', BASE_DIR . '/modules/gallery/templates');
$AVE_Template->assign('theme_folder', (defined('THEME_FOLDER') ? THEME_FOLDER : DEFAULT_THEME_FOLDER));
$gallery->galleryShow($tpl_dir, (int)$_REQUEST['gallery'], '', 1);
}
else
{
$gallery->galleryImageShow($tpl_dir, (int)$_REQUEST['image']);
}
}
//=======================================================
// Действия в админ-панели
//=======================================================
if (defined('ACP') && !empty($_REQUEST['moduleaction']))
{
require_once(BASE_DIR . '/modules/gallery/class.gallery.php');
$gallery = new Gallery;
$tpl_dir = BASE_DIR . '/modules/gallery/templates/';
$lang_file = BASE_DIR . '/modules/gallery/lang/' . $_SESSION['admin_language'] . '.txt';
$AVE_Template->config_load($lang_file, 'admin');
switch($_REQUEST['moduleaction'])
{
case '1': // Просмотр списка галерей
$gallery->galleryListShow($tpl_dir);
break;
case 'add': // Добавить изображения в галерею
define('IMAGE_TOOLBOX_DEFAULT_JPEG_QUALITY', 75);
include_once(BASE_DIR . '/class/class.thumbnail.php');
$Image_Toolbox = new Image_Toolbox;
$gallery->galleryImageUploadForm($tpl_dir, intval($_REQUEST['id']));
break;
case 'showimages': // Просмотр изображений галереи
$gallery->galleryImageListShow($tpl_dir, intval($_REQUEST['id']));
break;
case 'new': // Создать новую галерею
$gallery->galleryNew();
break;
case 'copygallery': // Копирование галереи
$gallery->galleryCopy(intval($_REQUEST['id']));
break;
case 'delgallery': // Удаление галереи
$gallery->galleryDelete(intval($_REQUEST['id']));
break;
case 'editgallery': // Редактирование галереи
$gallery->galleryEdit($tpl_dir, intval($_REQUEST['id']));
break;
}
}
?>

106
sql.php

@ -0,0 +1,106 @@
<?php
/**
* AVE.cms - Модуль Галерея.
*
* @package AVE.cms
* @subpackage module_Gallery
* @filesource
*/
/**
* mySQL-запросы для установки, обновления и удаления модуля
*/
$module_sql_install = array();
$module_sql_deinstall = array();
$module_sql_update = array();
//Удаление модуля
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_gallery;";
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_gallery_images;";
//Установка модуля
$module_sql_install[] = "CREATE TABLE `CPPREFIX_module_gallery` (
`id` int(10) unsigned NOT NULL auto_increment,
`gallery_title` varchar(255) NOT NULL,
`gallery_description` text NOT NULL,
`gallery_author_id` int(10) unsigned NOT NULL default '0',
`gallery_created` int(10) unsigned NOT NULL default '0',
`gallery_thumb_width` smallint(3) unsigned NOT NULL default '120',
`gallery_thumb_height` smallint(3) unsigned NOT NULL default '120',
`gallery_thumb_method` enum('c','r') NOT NULL default 'c',
`gallery_image_on_line` tinyint(1) unsigned NOT NULL default '4',
`gallery_image_on_page` tinyint(1) unsigned NOT NULL default '12',
`gallery_watermark` varchar(255) NOT NULL,
`gallery_folder` varchar(255) NOT NULL,
`gallery_orderby` enum('datedesc','dateasc','titleasc','titledesc','position') NOT NULL default 'datedesc',
`gallery_script` text NOT NULL,
`gallery_image_template` text NOT NULL,
`gallery_sepp_line` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;";
$module_sql_install[] = "CREATE TABLE `CPPREFIX_module_gallery_images` (
`id` int(10) unsigned NOT NULL auto_increment,
`gallery_id` int(10) unsigned NOT NULL default '0',
`image_filename` varchar(255) NOT NULL,
`image_author_id` int(10) unsigned NOT NULL default '0',
`image_title` varchar(255) NOT NULL,
`image_description` text NOT NULL,
`image_file_ext` char(4) NOT NULL,
`image_date` int(10) unsigned NOT NULL default '0',
`image_position` smallint(3) unsigned NOT NULL default '1',
`image_link` varchar(255) NOT NULL,
`image_status` enum('1','0') NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `image_position` (`image_position`),
KEY `image_date` (`image_date`),
KEY `gallery_id` (`gallery_id`),
KEY `image_title` (`image_title`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;";
// Обновление модуля
$module_sql_update[] = "
UPDATE
`CPPREFIX_module`
SET
ModuleAveTag = '" . $modul['ModuleAveTag'] . "',
ModulePHPTag = '" . $modul['ModulePHPTag'] . "',
ModuleVersion = '" . $modul['ModuleVersion'] . "'
WHERE
ModuleSysName = '" . $modul['ModuleSysName'] . "'
LIMIT 1;
";
$module_sql_update[] = "
RENAME TABLE
`CPPREFIX_modul_gallery`
TO
`CPPREFIX_module_gallery`
";
$module_sql_update[] = "
RENAME TABLE
`CPPREFIX_modul_gallery_images`
TO
`CPPREFIX_module_gallery_images`
";
$module_sql_update[] = "
ALTER TABLE `".PREFIX."_module_gallery_images`
ADD
`image_link`
varchar(255) NOT NULL default '' AFTER
`image_position`
";
$module_sql_update[] = "
ALTER TABLE `".PREFIX."_module_gallery_images`
ADD
`image_status`
enum('1','0') NOT NULL DEFAULT '1' AFTER
`image_link`
";
?>

401
templates/admin_gallery_edit.tpl

@ -0,0 +1,401 @@
<div class="title"><h5>{#ModSettingGal#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#ModSettingGalT#}
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=1&cp={$sess}">{#ModName#}</a></li>
<li>{#Overview#}</li>
<li><strong class="code">{$gallery.gallery_title|escape}</strong></li>
</ul>
</div>
</div>
<form class="mainForm" method="post" name="gallery_form" id="gallery_form" action="index.php?do=modules&action=modedit&mod=gallery&moduleaction=editgallery&id={$smarty.request.id|escape}&cp={$sess}&sub=save">
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#ModSettingGal#}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=add&id={$smarty.request.id|escape}&cp={$sess}">{#AddnewImages#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=showimages&id={$smarty.request.id|escape}&cp={$sess}&compile=1">{#ImageView#}</a></div>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="250">
<col>
<thead>
<tr>
<td>{#GallerySetParam#}</td>
<td>{#GallerySetVal#}</td>
</tr>
</thead>
<tr>
<td>{#GalleryTitle#}</td>
<td>
<input class="mousetrap" placeholder="{#GalleryTitle#}" name="gallery_title" type="text" id="gallery_title" value="{$gallery.gallery_title|escape}" size="40" style="width:500px" />
<input name="gallery_title_old" type="hidden" value="{$gallery.gallery_title|escape}" />
</td>
</tr>
<tr>
<td>{#GalleryDesc#}</td>
<td>
<textarea class="mousetrap" placeholder="{#GalleryDesc#}" name="gallery_description" cols="40" rows="5" id="gallery_description" style="width:500px">{$gallery.gallery_description|escape}</textarea>
</td>
</tr>
<tr>
<td>{#GalleryFolder#}</td>
<td>
<input name="gallery_folder_old" type="hidden" value="{$gallery.gallery_folder|escape}" />
<input class="mousetrap rightDir" placeholder="{#GalleryFolderP#}" name="gallery_folder" title="{#GalleryFolderDesc#}" type="text" id="dir__0" size="40" value="{$gallery.gallery_folder|escape}" style="width:500px" />&nbsp;
<input type="button" class="basicBtn topDir" value="..." title="{#MAIN_OPEN_MEDIAPATH#}" onclick="browse_uploads('dir__0');" />
</td>
</tr>
<tr>
<td>{#Watermark#}</td>
<td>
<div><img id="preview__0" src="{if $gallery.gallery_watermark != ""}../{$gallery.gallery_watermark|escape}{else}{$blank}{/if}" alt="" border="0" /></div>
<input class="mousetrap" placeholder="{#Watermark#}" name="gallery_watermark" type="text" id="image__0" value="{$gallery.gallery_watermark|escape}" size="40" style="width:500px" />&nbsp;
<input type="button" class="basicBtn topDir" value="..." title="{#MAIN_OPEN_MEDIAPATH#}" onclick="browse_uploads('image__0');" />
</td>
</tr>
<tr>
<td>{#MaxWidth#}</td>
<td>
<input class="mousetrap rightDir" name="gallery_thumb_width" title="{#MaxWidthWarn#}" type="text" id="gallery_thumb_width" value="{$gallery.gallery_thumb_width}" size="5" maxlength="3" style="width: 35px;" />
<input name="thumb_width_old" type="hidden" value="{$gallery.gallery_thumb_width}" />
</td>
</tr>
<tr>
<td>{#MaxHeight#}</td>
<td>
<input class="mousetrap rightDir" name="gallery_thumb_height" title="{#MaxHeightWarn#}" type="text" id="gallery_thumb_height" value="{$gallery.gallery_thumb_height}" size="5" maxlength="3" style="width: 35px;" />
<input name="gallery_thumb_old" type="hidden" value="{$gallery.gallery_thumb_height}" />
</td>
</tr>
<tr>
<td>{#ThumbMethod#}</td>
<td>
<select name="gallery_thumb_method" style="width:250px">
<option value="c" {if $gallery.gallery_thumb_method == 'c'}selected="selected" {/if}/>{#Crop#}</option>
<option value="r" {if $gallery.gallery_thumb_method == 'r'}selected="selected" {/if}/>{#Resize#}</option>
</select>
</td>
</tr>
<tr>
<td>{#MaxImagesERow#}</td>
<td>
<input class="mousetrap" name="gallery_image_on_line" type="text" id="gallery_image_on_line" value="{$gallery.gallery_image_on_line}" size="5" maxlength="2" style="width: 35px;" />
</td>
</tr>
<tr>
<td class="first">{#MaxImagesPage#}</td>
<td>
<input class="mousetrap" name="gallery_image_on_page" type="text" id="gallery_image_on_page" value="{$gallery.gallery_image_on_page}" size="5" maxlength="4" style="width: 35px;" />
</td>
</tr>
<tr>
<td>{#OrderImage#}</td>
<td>
<select name="gallery_orderby" style="width:250px">
<option value="dateasc" {if $gallery.gallery_orderby == 'dateasc'}selected="selected" {/if}/>{#OrderDateAsc#}</option>
<option value="datedesc" {if $gallery.gallery_orderby == 'datedesc'}selected="selected" {/if}/>{#OrderDateDesc#}</option>
<option value="titleasc" {if $gallery.gallery_orderby == 'titleasc'}selected="selected" {/if}/>{#OrderTitleAsc#}</option>
<option value="titledesc" {if $gallery.gallery_orderby == 'titledesc'}selected="selected" {/if}/>{#OrderTitleDesc#}</option>
<option value="position" {if $gallery.gallery_orderby == 'position'}selected="selected" {/if}/>{#OrderPosition#}</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" class="basicBtn" value="{#ButtonSave#}" />
<input type="submit" class="blackBtn SaveEdit" value="{#ButtonSaveEdit#}" />
</td>
</tr>
</table>
</div>
<div class="widget first">
<div class="head"><h5 class="iFrames">{#GalleryScripts#}</h5></div>
<link rel="stylesheet" href="{$ABS_PATH}admin/codemirror/lib/codemirror.css">
<script src="{$ABS_PATH}admin/codemirror/lib/codemirror.js" type="text/javascript"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/xml/xml.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/javascript/javascript.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/css/css.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/clike/clike.js"></script>
<script src="{$ABS_PATH}admin/codemirror/mode/php/php.js"></script>
{literal}
<style type="text/css">
.activeline {background: #e8f2ff !important;}
.CodeMirror-scroll {height: 300px;}
</style>
{/literal}
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="250">
<col>
<thead>
<tr>
<td>{#GalleryScriptsTag#}</td>
<td>{#GalleryScripts#}</td>
</tr>
</thead>
<tbody>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagId#}" href="javascript:void(0);" onclick="textSelection('[tag:gal:id]', '');">[tag:gal:id]</a></strong></td>
<td rowspan="9"><textarea name="gallery_script" cols="80" rows="10" id="gallery_script" style="width:100%">{$gallery.gallery_script|escape}</textarea></td>
</tr>
<tr>
<td>
<strong><a class="rightDir" title="{#GalleryTagFolder#}" href="javascript:void(0);" onclick="textSelection('[tag:gal:folder]', '');">[tag:gal:folder]</a></strong>
</td>
</tr>
<tr>
<td>
<strong><a class="rightDir" title="{#GalleryTagTitl#}" href="javascript:void(0);" onclick="textSelection('[tag:gal:title]', '');">[tag:gal:title]</a></strong>
</td>
</tr>
<tr>
<td>
<strong><a class="rightDir" title="{#GalleryTagDesc#}" href="javascript:void(0);" onclick="textSelection('[tag:gal:description]', '');">[tag:gal:description]</a></strong>
</td>
</tr>
<tr>
<td>
<strong><a class="rightDir" title="{#GalleryTagContent#}" href="javascript:void(0);" onclick="textSelection('[tag:gal:content]', '');">[tag:gal:content]</a></strong>
</td>
</tr>
<tr>
<td>
<strong><a class="rightDir" title="{#GalleryTagPages#}" href="javascript:void(0);" onclick="textSelection('[tag:gal:pages]', '');">[tag:gal:pages]</a></strong>
</td>
</tr>
<tr>
<td>
<strong><a class="rightDir" title="{#GalleryTagPath#}" href="javascript:void(0);" onclick="textSelection('[tag:path]', '');">[tag:path]</a></strong>
</td>
</tr>
<tr>
<td>
<strong><a class="rightDir" title="{#GalleryMediaPath#}" href="javascript:void(0);" onclick="textSelection('[tag:mediapath]', '');">[tag:mediapath]</a></strong>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>{#GalleryTags#}</td>
<td>
|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<ol>', '</ol>');"><strong>OL</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<ul>', '</ul>');"><strong>UL</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<li>', '</li>');"><strong>LI</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<strong>', '</strong>');"><strong>B</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<em>', '</em>');"><strong>I</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<h1>', '</h1>');"><strong>H1</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<h2>', '</h2>');"><strong>H2</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<h3>', '</h3>');"><strong>H3</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<h4>', '</h4>');"><strong>H4</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<h5>', '</h5>');"><strong>H5</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<span>', '</span>');"><strong>SPAN</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<pre>', '</pre>');"><strong>PRE</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('<br />', '');"><strong>BR</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection('\t', '');"><strong>TAB</strong></a>&nbsp;|
</td>
</tr>
</tbody>
</table>
</div>
<div class="widget first">
<div class="head"><h5 class="iFrames">{#ImageTpl#}</h5></div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="250">
<col>
<thead>
<tr>
<td>{#ImageTplTag#}</td>
<td>{#ImageTpl#}</td>
</tr>
</thead>
<tbody>
<tr>
<td>{#GalleryIfElse#}</td>
<td>
|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_first]', '[tag:/if]');"><strong>[tag:if_first]</strong></a>
&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_first]', '[tag:/if]');"><strong>[tag:if_not_first]</strong></a>
&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_last]', '[tag:/if]');"><strong>[tag:if_last]</strong></a>
&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_last]', '[tag:/if]');"><strong>[tag:if_not_last]</strong></a>
&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_every:]', '[tag:/if]');"><strong>[tag:if_every:XXX]</strong></a>
&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_not_every:]', '[tag:/if]');"><strong>[tag:if_not_every:XXX]</strong></a>
&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('[tag:if_every:2]\r\n\t{#GallerySample1#}\r\n[tag:if:else]\r\n\t{#GallerySample2#}\r\n[tag:/if]', '');"><strong>{#GallerySample#}</strong></a>
&nbsp;|
</td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagId#}" href="javascript:void(0);" onclick="textSelection2('[tag:gal:id]', '');">[tag:gal:id]</a></strong></td>
<td rowspan="11"><textarea name="gallery_image_template" cols="80" rows="11" id="gallery_image_template" style="width:100%">{$gallery.gallery_image_template|escape}</textarea></td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagFolder#}" href="javascript:void(0);" onclick="textSelection2('[tag:gal:folder]', '');">[tag:gal:folder]</a></strong></td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagTitl#}" href="javascript:void(0);" onclick="textSelection2('[tag:gal:title]', '');">[tag:gal:title]</a></strong></td>
</tr>
<tr>
<td>
<strong><a class="rightDir" title="{#GalleryTagPath#}" href="javascript:void(0);" onclick="textSelection2('[tag:path]', '');">[tag:path]</a></strong>
</td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagImgId#}" href="javascript:void(0);" onclick="textSelection2('[tag:img:id]', '');">[tag:img:id]</a></strong></td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagImgTitle#}" href="javascript:void(0);" onclick="textSelection2('[tag:img:title]', '');">[tag:img:title]</a></strong></td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagImgDesc#}" href="javascript:void(0);" onclick="textSelection2('[tag:img:description]', '');">[tag:img:description]</a></strong></td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagImgFilename#}" href="javascript:void(0);" onclick="textSelection2('[tag:img:original]', '');">[tag:img:original]</a></strong></td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagImgThumb#}" href="javascript:void(0);" onclick="textSelection2('[tag:img:thumbnail]', '');">[tag:img:thumbnail]</a></strong></td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagImgSize#}" href="javascript:void(0);" onclick="textSelection2('[tag:img:size]', '');">[tag:img:size]</a></strong></td>
</tr>
<tr>
<td><strong><a class="rightDir" title="{#GalleryTagLink#}" href="javascript:void(0);" onclick="textSelection2('[tag:link]', '');">[tag:link]</a></strong></td>
</tr>
<tr>
<td>{#GalleryTags#}</td>
<td>
|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<ol>', '</ol>');"><strong>OL</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<ul>', '</ul>');"><strong>UL</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<li>', '</li>');"><strong>LI</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<p class=&quot;&quot;>', '</p>');"><strong>P</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<strong>', '</strong>');"><strong>B</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<em>', '</em>');"><strong>I</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<h1>', '</h1>');"><strong>H1</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<h2>', '</h2>');"><strong>H2</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<h3>', '</h3>');"><strong>H3</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<h4>', '</h4>');"><strong>H4</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<h5>', '</h5>');"><strong>H5</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<div class=&quot;&quot; id=&quot;&quot;>', '</div>');"><strong>DIV</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<a href=&quot;&quot; title=&quot;&quot;>', '</a>');"><strong>A</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<img src=&quot;&quot; alt=&quot;&quot; />', '');"><strong>IMG</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<span>', '</span>');"><strong>SPAN</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<pre>', '</pre>');"><strong>PRE</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('<br />', '');"><strong>BR</strong></a>&nbsp;|&nbsp;
<a href="javascript:void(0);" onclick="textSelection2('\t', '');"><strong>TAB</strong></a>&nbsp;|
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" class="basicBtn" value="{#ButtonSave#}" />
{#Or#}
<input type="submit" class="blackBtn SaveEdit" value="{#ButtonSaveEdit#}" />
</td>
</tr>
</tbody>
</table>
<script language="javascript">
var sett_options = {ldelim}
url: 'index.php?do=modules&action=modedit&mod=gallery&moduleaction=editgallery&id={$smarty.request.id|escape}&cp={$sess}&sub=save',
beforeSubmit: Request,
success: Response
{rdelim}
function Request(){ldelim}
$.alerts._overlay('show');
{rdelim}
function Response(){ldelim}
$.alerts._overlay('hide');
$.jGrowl('{#SavedOk#}');
{rdelim}
$(document).ready(function(){ldelim}
Mousetrap.bind(['ctrl+s', 'meta+s'], function(event) {ldelim}
if (event.preventDefault) {ldelim}
event.preventDefault();
{rdelim} else {ldelim}
// internet explorer
event.returnValue = false;
{rdelim}
$("#gallery_form").ajaxSubmit(sett_options);
return false;
{rdelim});
$(".SaveEdit").click(function(event){ldelim}
if (event.preventDefault) {ldelim}
event.preventDefault();
{rdelim} else {ldelim}
// internet explorer
event.returnValue = false;
{rdelim}
$("#gallery_form").ajaxSubmit(sett_options);
return false;
{rdelim});
{rdelim});
</script>
</div>
</form>
{include file="$codemirror_connect"}
{include file="$codemirror_editor" conn_id="" textarea_id='gallery_script' ctrls='$("#gallery_form").ajaxSubmit(sett_options);' height=280}
{include file="$codemirror_editor" conn_id="2" textarea_id='gallery_image_template' ctrls='$("#gallery_form").ajaxSubmit(sett_options);' height=300}
<script language="javascript">
{if $empty_gallery_title == 1}
alert("{#EmptyGalleryTitle#}");
{/if}
{if $folder_exist == 1}
alert("{#FolderExists#}");
{/if}
</script>

168
templates/admin_gallery_image.tpl

@ -0,0 +1,168 @@
<script language="Javascript" type="text/javascript">
function openLinkWin(target) {ldelim}
if (typeof width=='undefined' || width=='') var width = screen.width * 0.6;
if (typeof height=='undefined' || height=='') var height = screen.height * 0.6;
var left = ( screen.width - width ) / 2;
var top = ( screen.height - height ) / 2;
window.open('index.php?do=docs&action=showsimple&target='+target+'&selurl=1&pop=1','pop','left='+left+',top='+top+',width='+Math.min(screen.width, 1000)+',height='+Math.min(screen.height, 600)+',scrollbars=1,resizable=1');
{rdelim}
$(document).ready(function(){ldelim}
$('#selall').on('change', function(event) {ldelim}
event.preventDefault();
if ($('#selall').is(':checked')) {ldelim}
$('#Fields .checkbox').attr('checked','checked');
$('#Fields .checkbox').addClass('jqTransformChecked');
$("#Fields a.jqTransformCheckbox").addClass("jqTransformChecked");
{rdelim} else {ldelim}
$('#Fields .checkbox').removeClass('jqTransformChecked');
$('#Fields .checkbox').removeAttr('checked');
$("#Fields a.jqTransformCheckbox").removeClass("jqTransformChecked");
{rdelim}
{rdelim});
$(".ConfirmDelete").click(function(event){ldelim}
event.preventDefault();
var href = $(this).attr('href');
var title = '{#DOC_FINAL_DELETE#}';
var confirm = '{#DOC_FINAL_CONFIRM#}';
jConfirm(
confirm,
title,
function(b){ldelim}
if (b){ldelim}
$.alerts._overlay('show');
window.location = href;
{rdelim}
{rdelim}
);
{rdelim});
$(".galleryimages a").hover( function(){ldelim}
$(this).children("img").animate({ldelim} opacity: 0.5 {rdelim}, "fast");
{rdelim}, function(){ldelim}
$(this).children("img").animate({ldelim} opacity: 1.0 {rdelim}, "fast");
{rdelim});
{rdelim});
</script>
<div class="title"><h5>{#Overview#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#OverviewT#}
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=1&cp={$sess}">{#ModName#}</a></li>
<li>{#Overview#}</li>
<li><strong class="code">{$gallery_title}</strong></li>
</ul>
</div>
</div>
{if $page_nav}
<div class="pagination">
<ul class="pages">
{$page_nav}
</ul>
</div>
{/if}
<div class="widget first">
<div class="head">
<h5 class="iFrames">{#Overview#}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&amp;action=modedit&amp;mod=gallery&amp;moduleaction=add&amp;id={$smarty.request.id|escape}&amp;cp={$sess}">{#AddnewImages#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=editgallery&id={$smarty.request.id|escape}&cp={$sess}">{#EditGallery#}</a></div>
</div>
<form name="kform" class="mainForm" method="post" action="index.php?do=modules&action=modedit&mod=gallery&moduleaction=showimages&id={$smarty.request.id|escape}&cp={$sess}&sub=save&page={$smarty.request.page|escape}">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic" id="Fields">
<col width="20">
<col width="50">
<col width="120">
<col width="">
<col width="">
<col width="">
<col width="16">
<thead>
<tr>
<td align="center"><div align="center"><input title="{#MarAllDel#}" type="checkbox" id="selall" value="1" /></div></td>
<td align="center">{#Position#}</td>
<td>{#FilePrev#}</td>
<td>{#FileTitle#}</td>
<td>{#FileDesc#}</td>
<td>{#MoreInfos#}</td>
<td></td>
</tr>
</thead>
{foreach from=$images item=image}
<tr>
<td valign="top">
<input type="hidden" value="{$image.id}" name="gimg[]" />
<input type="hidden" value="{$image.image_filename|escape}" name="datei[{$image.id}]" />
<input title="{#MarDel#}" name="del[{$image.id}]" class="checkbox topDir" type="checkbox" id="del[{$image.id}]" value="1" />
</td>
<td valign="top">
<div class="pr12"><input name="image_position[{$image.id}]" type="text" style="width:30px" id="image_position[{$image.id}]" value="{$image.image_position}"></div>
</td>
<td valign="top" class="galleryimages">
<a href="{$image.original}" class="fancy">
<img src="{$image.thumbnail}" width="100" alt="" border="0" />
</a>
</td>
<td valign="top">
<div class="pr12"><input placeholder="{#FileTitle#}" name="image_title[{$image.id}]" type="text" id="image_title[{$image.id}]" value="{$image.image_title|escape}"></div>
<br />
<input placeholder="{#LinkDoc#}" name="image_link[{$image.id}]" type="text" id="Link_{$image.id}" value="{$image.image_link}" style="width: 70%;" />
<input title="{#LinkToDoc#}" onclick="openLinkWin('Link_{$image.id}','Link_{$image.id}');" type="button" class="basicBtn topDir" value="... " />
</td>
<td valign="top">
<div class="pr12"><textarea placeholder="{#FileDesc#}" name="image_description[{$image.id}]" style="height: 60px" id="image_description[{$image.id}]">{$image.image_description|escape}</textarea></div>
</td>
<td valign="top">
<strong>{#Uploader#}</strong>: {$image.image_author|escape}<br />
<strong>{#UploadOn#}</strong>: {$image.image_date|date_format:$TIME_FORMAT|pretty_date}<br />
<strong>{#Filename#}</strong>: {$image.image_filename|escape}<br />
<strong>{#Filesize#}</strong>: {$image.image_size} kb
</td>
<td valign="top" style="width: 16px;">
<input title="{#MarAct#}" name="image_status[{$image.id}]" class="checkbox topleftDir" type="checkbox" id="image_status[{$image.id}]" value="1" {if $image.image_status == '1'} checked="checked"{/if} />
</td>
</tr>
{/foreach}
<tr>
<td colspan="7">
<input class="basicBtn" type="submit" value="{#ButtonSave#}" />
</td>
</tr>
</table>
</form>
</div>
{if $page_nav}
<div class="pagination">
<ul class="pages">
{$page_nav}
</ul>
</div>
{/if}

204
templates/admin_gallery_list.tpl

@ -0,0 +1,204 @@
<script type="text/javascript" language="JavaScript">
$(document).ready(function(){ldelim}
$(".CopyGallery").click( function(e) {ldelim}
e.preventDefault();
var href = $(this).attr('href');
var title = '{#GalleryCopy#}';
var text = '{#GalleryCopyT#}';
jPrompt(text, '', title, function(b){ldelim}
if (b){ldelim}
$.alerts._overlay('show');
window.location = href + '&gallery_title=' + b;
{rdelim}
{rdelim}
);
{rdelim});
$(".AddGallery").click( function(e) {ldelim}
e.preventDefault();
var user_group = $('#add_gallery #gallery_title').fieldValue();
var title = '{#NewGallery#}';
var text = '{#EmptyGalleryTitle#}';
if (user_group == ""){ldelim}
jAlert(text,title);
{rdelim}else{ldelim}
$.alerts._overlay('show');
$("#add_gallery").submit();
{rdelim}
{rdelim});
{rdelim});
</script>
<div class="title"><h5>{#ModName#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#ModTitle#}
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li>{#ModName#}</li>
</ul>
</div>
</div>
<div class="widget first">
<ul class="tabs">
<li class="activeTab"><a href="#tab1">{#GalleryList#}</a></li>
<li class=""><a href="#tab2">{#NewGallery#}</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content" style="display: block;">
<form action="" method="post" class="mainForm">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<col width="20">
<col>
<col width="150">
<col width="150">
<col width="200">
<col width="150">
<col width="100">
<col width="20">
<col width="20">
<col width="20">
<col width="20">
<col width="20">
<thead>
<tr>
<td><div align="center"><a href="javascript:void(0);" class="toprightDir icon_sprite ico_info" title="{#CheckboxCreate#}"></a></div></td>
<td>{#GalleryTitle#}</td>
<td>{#CpTag#}</td>
<td>{#GalleryAuthor#}</td>
<td>{#Folder#}</td>
<td>{#Gcreated#}</td>
<td>{#IncImages#}</td>
<td colspan="5">{#Actions#}</td>
</tr>
</thead>
<tbody>
<form action="" method="post" class="mainForm">
{foreach from=$galleries item=gallery}
<tr>
<td>
<input type="checkbox" name="create[]" value="{$gallery.id}" {if $gallery.gallery_folder != ''}disabled="disabled"{/if} />
</td>
<td>
{if $gallery.image_count > 0}
<strong class="docname"><a class="topDir" title="{#ImageView#}" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=showimages&id={$gallery.id}&cp={$sess}&compile=1">{$gallery.gallery_title|escape}</a></strong>
{else}
<strong>{$gallery.gallery_title|escape}</strong>
{/if}
</td>
<td>
<div class="pr12"><input name="textfield" type="text" readonly value="[mod_gallery:{$gallery.id}]" size="17" /></div>
</td>
<td align="center">
<a class="topDir" title="{#UserProfile#}" href="index.php?do=user&action=edit&id={$gallery.gallery_author_id}&cp={$sess}">{$gallery.username|escape}</a>
</td>
<td align="center">{$gallery.gallery_folder|escape}</td>
<td align="center"><span class="date_text dgrey">{$gallery.gallery_created|date_format:$TIME_FORMAT|pretty_date}</span></td>
<td>
<div align="center">
{if $gallery.image_count > 0}
<strong><a class="topDir" title="{#ImageView#}" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=showimages&id={$gallery.id}&cp={$sess}">{$gallery.image_count}</a></strong>
{else}-{/if}
</div>
</td>
<td>
<a class="topleftDir icon_sprite ico_look" title="{#ImageView#}" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=showimages&id={$gallery.id}&cp={$sess}&compile=1"></a>
</td>
<td>
<a class="topleftDir icon_sprite ico_add" title="{#AddnewImages#}" href="index.php?do=modules&amp;action=modedit&amp;mod=gallery&amp;moduleaction=add&amp;id={$gallery.id}&amp;cp={$sess}"></a>
</td>
<td>
<a class="topleftDir icon_sprite ico_setting" title="{#EditGallery#}" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=editgallery&id={$gallery.id}&cp={$sess}"></a>
</td>
<td>
<a class="topleftDir icon_sprite ico_copy CopyGallery" title="{#CopyGallery#}" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=copygallery&id={$gallery.id}&cp={$sess}"></a>
</td>
<td>
<a class="topleftDir ConfirmDelete icon_sprite ico_delete" title="{#DeleteGallery#}" dir="{#DeleteGallery#}" name="{#DeleteGalleryC#}" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=delgallery&id={$gallery.id}&cp={$sess}"></a>
</td>
</tr>
{/foreach}
{if !$galleries}
<tr>
<td colspan="9">
<ul class="messages">
<li class="highlight yellow">{#GallerryNoItems#}</li>
</ul>
</td>
</tr>
{/if}
</form>
</tbody>
</table>
</form>
{if $galleries}
<div class="rowElem">
<input class="basicBtn" type="submit" value="{#CreateFolder#}" />
</div>
{/if}
</div>
<div id="tab2" class="tab_content" style="display: none;">
<form id="add_gallery" action="{$formaction}" method="post" class="mainForm">
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<tr class="noborder">
<td width="180">{#GalleryTitle#}</td>
<td>
<input placeholder="{#GalleryTitle#}" name="gallery_title" type="text" id="gallery_title" value="" style="width:300px" />
</td>
</tr>
<tr>
<td width="180">{#GalleryDesc#}</td>
<td>
<textarea placeholder="{#GalleryDesc#}" name="gallery_description" cols="50" rows="4" id="gallery_description" style="width:300px"></textarea>
</td>
</tr>
<tr>
<td width="180">{#GalleryFolder#}</td>
<td>
<input placeholder="{#GalleryFolderP#}" name="gallery_folder" type="text" id="gallery_folder" size="40" value="" style="width:300px" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" class="basicBtn AddGallery" value="{#ButtonAdd#}" />
</td>
</tr>
</table>
</form>
</div>
</div>
<div class="fix"></div>
</div>
{if $page_nav}
<div class="pagination">
<ul class="pages">
{$page_nav}
</ul>
</div>
{/if}
{if $alert == "folder_exists"}
<script type="text/javascript" language="JavaScript">
$.jGrowl("{#FolderExists#}");
</script>
{/if}

128
templates/admin_gallery_upload_form.tpl

@ -0,0 +1,128 @@
<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
<script type="text/javascript" src="{$ABS_PATH}lib/scripts/uploader/plupload.full.min.js"></script>
<script type="text/javascript" src="{$ABS_PATH}lib/scripts/uploader/jquery.plupload.queue.js"></script>
<script type="text/javascript" src="{$ABS_PATH}lib/scripts/uploader/i18n/{$smarty.session.admin_language}.js"></script>
<script language="javascript" type="text/javascript">
{literal}
$(document).ready(function(){
//===== File uploader =====//
$("#uploader").pluploadQueue({
runtimes : 'html5,flash',
url : ave_path+'modules/gallery/upload.php',
max_file_size : '20mb',
unique_names : true,
filters : [
{title : "Image files", extensions : "jpg,jpeg,jpe,gif,png"},
{title : "Video files", extensions : "avi,mov,wmv,wmf"}
],
// Flash settings
flash_swf_url : '/lib/scripts/uploader/Moxie.swf'
});
// Client side form validation
$('form').submit(function(e) {
var uploader = $('#uploader').pluploadQueue();
// Files in queue upload them first
// When all files are uploaded submit form
uploader.bind('StateChanged', function() {
if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
$('form')[0].submit();
}
});
uploader.start();
return false;
});
});
{/literal}
</script>
<div class="title"><h5>{#Upload#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#UploadInfo#} <strong>{foreach from=$allowed item=a}{$a|escape} {/foreach}</strong>
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=1&cp={$sess}">{#ModName#}</a></li>
<li>{#Upload#}</li>
<li><strong class="code">{$gallery_title|escape}</strong></li>
</ul>
</div>
</div>
{if $not_writeable == 1}
<ul class="messages">
<li class="highlight red">{#ErrorFolderStart#}{$upload_dir|escape}{#ErrorFolderEnd#}</li>
</ul>
{else}
<form class="mainForm" method="post" action="{$formaction}" enctype="multipart/form-data">
<input name="fromuploader" type="hidden" id="fromuploader" value="1" />
<fieldset>
<div class="widget">
<div class="head">
<h5>{#Upload#}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=editgallery&id={$smarty.request.id|escape}&cp={$sess}">{#EditGallery#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=showimages&id={$smarty.request.id|escape}&cp={$sess}&compile=1">{#ImageView#}</a></div>
</div>
<div id="uploader" style="position: relative;"></div>
</div>
</fieldset>
<div class="widget">
<div class="head">
<h5>{#Upload#}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
<tr class="noborder">
<td width="200"><strong>{#Shrink#}</strong></td>
<td>
<select name="shrink" id="shrink">
<option value="100">{#To100#}</option>
<option value="75">{#To75#}</option>
<option value="50">{#To50#}</option>
<option value="25">{#To25#}</option>
</select>
</td>
</tr>
<tr>
<td width="200"><strong>{#MaxSize#}</strong></td>
<td>
<input name="maxsize" type="text" value="2000" maxlength="4" size="4" style="width: 50px;" />&nbsp;px
</td>
</tr>
<tr>
<td width="200"><strong>{#LoadFromFolder#}</strong></td>
<td>
<input name="fromfolder" type="checkbox" id="fromfolder" value="1" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" class="basicBtn" value="{#ButtonSave#}" />
</td>
</tr>
</table>
<div class="fix"></div>
</div>
</form>
{/if}

37
templates/admin_gallery_upload_form_finish.tpl

@ -0,0 +1,37 @@
<div class="title"><h5>{#UploadProg#}</h5></div>
<div class="widget" style="margin-top: 0px;">
<div class="body">
{#UploadInfo#}
</div>
</div>
<div class="breadCrumbHolder module">
<div class="breadCrumb module">
<ul>
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
<li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=1&cp={$sess}">{#ModName#}</a></li>
<li>{#UploadProg#}</li>
<li><strong class="code">{$gallery_title|escape}</strong></li>
</ul>
</div>
</div>
<div class="widget">
<div class="head">
<h5>{#UploadProgT#}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=add&id={$smarty.request.id|escape}&cp={$sess}">{#AddnewImages#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=showimages&id={$smarty.request.id|escape}&cp={$sess}&compile=1">{#ImageView#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=editgallery&id={$smarty.request.id|escape}&cp={$sess}">{#EditGallery#}</a></div>
</div>
<div class="rowElem">
<div style="padding:12px;height:200px;overflow:auto;border:1px solid #ccc">
{foreach from=$images item=image}<img src="{$image}" align="left" style="margin:5px" />{/foreach}
</div>
</div>
<div class="fix"></div>
</div>

131
upload.php

@ -0,0 +1,131 @@
<?php
// HTTP headers for no cache etc
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
ob_start();
ob_implicit_flush(0);
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(dirname(__FILE__)))));
require(BASE_DIR . '/inc/init.php');
if (!isset($_SESSION['user_id']))
{
header('Location:index.php');
exit;
}
// Settings
$targetDir = BASE_DIR.'/'. UPLOAD_GALLERY_DIR .'/.uploader/'.$_SESSION['user_id'];
$cleanupTargetDir = true; // Remove old files
$maxFileAge = 5 * 3600; // Temp file age in seconds
// 5 minutes execution time
@set_time_limit(5 * 60);
// Get parameters
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
// Clean the fileName for security reasons
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
// Make sure the fileName is unique but only if chunking is disabled
if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
$ext = strrpos($fileName, '.');
$fileName_a = substr($fileName, 0, $ext);
$fileName_b = substr($fileName, $ext);
$count = 1;
while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName_a . '_' . $count . $fileName_b))
$count++;
$fileName = $fileName_a . '_' . $count . $fileName_b;
}
$filePath = $targetDir . DIRECTORY_SEPARATOR . $_FILES['file']['name'];
// Create target dir
if (!file_exists($targetDir))
@mkdir($targetDir,0777);
// Remove old temp files
if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
while (($file = readdir($dir)) !== false) {
$tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
// Remove temp file if it is older than the max age and is not the current file
if (preg_match('/\.part$/', $file) && (filemtime($tmpfilePath) < time() - $maxFileAge) && ($tmpfilePath != "{$filePath}.part")) {
@unlink($tmpfilePath);
}
}
closedir($dir);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
if (isset($_SERVER["CONTENT_TYPE"]))
$contentType = $_SERVER["CONTENT_TYPE"];
// Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
if (strpos($contentType, "multipart") !== false) {
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
// Open temp file
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen($_FILES['file']['tmp_name'], "rb");
if ($in) {
while ($buff = fread($in, 4096))
fwrite($out, $buff);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
fclose($in);
fclose($out);
@unlink($_FILES['file']['tmp_name']);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
} else {
// Open temp file
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen("php://input", "rb");
if ($in) {
while ($buff = fread($in, 4096))
fwrite($out, $buff);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
fclose($in);
fclose($out);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
// Check if file has been uploaded
if (!$chunks || $chunk == $chunks - 1) {
// Strip the temp .part suffix off
rename("{$filePath}.part", $filePath);
}
// Return JSON-RPC response
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
?>
Loading…
Cancel
Save