Hi Mark, thats all I found in Dasboard menus.
Becouse I dont know how to html code make be seen in that forum I have copy/paste html code, chunks and snipets and created files galleryMarkH.odt and galleryMarkH.doc files.
http://www.sendspace.com/file/kuwvex
http://www.sendspace.com/file/faabvv
Thx for having a look at it!
Main Page is
<html>
<head>
<script type="text/javascript" src="assets/components/gallery/packages/galleriffic20/js/jquery-1.3.2.js"></script>
<title>[[++site_name]] - [[*pagetitle]]</title>
<base href="[[++site_url]]" />
<link rel="stylesheet" href="
http://modx.com/assets/components/discuss/themes/modx/css/index.css" type="text/css" />
<link rel="stylesheet" href="
http://modx.com/assets/components/discuss/themes/modx/css/jquery-ui-1.8.16.custom.css" type="text/css" />
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/jquery.scrollTo-min.js"></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/discuss.js"></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/sh/shCore.js"></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/sh/shAutoloader.js"></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/sh/shDiscuss.js"></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/dis.sticky.js"></script>
<script type="text/javascript">// <![CDATA[
DIS.url = "/";DIS.shJsUrl = "
http://modx.com/assets/components/discuss/themes/modx/js/sh/";DIS.config.connector = "
http://modx.com/assets/components/discuss/connector.php"
// ]]></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/dis.post.modify.js"></script>
<script type="text/javascript" src="
http://modx.com/assets/components/discuss/themes/modx/js/dis.post.buttons.js"></script>
</head>
<body>
[[*content]]
[[!Gallery? &plugin=`galleriffic` &album=`Name: System Shock`]]
<script type="text/javascript">
var DISModifyPost = $(function() {
DIS.config.attachments_max_per_post = 5;
DIS.DISModifyPost.init({
attachments: 1
});
});</script>
</body>
</html>
Chunk: galAlbumRowTpl
<li[[+cls:notempty=` class="[[+cls]]"`]]><a href="[[~[[*id]]? &[[+albumRequestVar]]=`[[+id]]`]]">[[+showName:notempty=`[[+name]]`]]</a></li>
Chunk: galItemThumb
<div class="[[+cls]]">
<a href="[[+linkToImage:if=`[[+linkToImage]]`:is=`1`:then=`[[+image_absolute]]`:else=`[[~[[*id]]?
&[[+imageGetParam]]=`[[+id]]`
&[[+albumRequestVar]]=`[[+album]]`
&[[+tagRequestVar]]=`[[+tag]]` ]]`]]">
<img class="[[+imgCls]]" src="[[+thumbnail]]" alt="[[+name]]" />
</a>
</div>
Snipet: Gallery
<?php
/**
* Gallery
*
* Copyright 2010-2012 by Shaun McCormick <
[email protected]>
*
* Gallery 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.
*
* Gallery 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
* Gallery; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package gallery
*/
/**
* The main Gallery snippet.
*
* @var modX $modx
* @var Gallery $gallery
*
* @package gallery
*/
$gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties);
if (!($gallery instanceof Gallery)) return '';
$modx->lexicon->load('gallery:web');
/* setup default properties */
$album = $modx->getOption('album',$scriptProperties,false);
$plugin = $modx->getOption('plugin',$scriptProperties,'');
$tag = $modx->getOption('tag',$scriptProperties,'');
$limit = $modx->getOption('limit',$scriptProperties,0);
$start = $modx->getOption('start',$scriptProperties,0);
$sort = $modx->getOption('sort',$scriptProperties,'rank');
$sortAlias = $modx->getOption('sortAlias',$scriptProperties,'galItem');
if ($sort == 'rank') $sortAlias = 'AlbumItems';
$dir = $modx->getOption('dir',$scriptProperties,'ASC');
$showInactive = $modx->getOption('showInactive',$scriptProperties,false);
$linkToImage = $modx->getOption('linkToImage',$scriptProperties,false);
$imageGetParam = $modx->getOption('imageGetParam',$scriptProperties,'galItem');
$albumRequestVar = $modx->getOption('albumRequestVar',$scriptProperties,'galAlbum');
$tagRequestVar = $modx->getOption('tagRequestVar',$scriptProperties,'galTag');
$itemCls = $modx->getOption('itemCls',$scriptProperties,'gal-item');
$activeCls = $modx->getOption('activeCls',$scriptProperties,'gal-item-active');
$highlightItem = $modx->getOption($imageGetParam,$_REQUEST,false);
/* check for REQUEST vars if property set */
if ($modx->getOption('checkForRequestAlbumVar',$scriptProperties,true)) {
if (!empty($_REQUEST[$albumRequestVar])) $album = $_REQUEST[$albumRequestVar];
}
if ($modx->getOption('checkForRequestTagVar',$scriptProperties,true)) {
if (!empty($_REQUEST[$tagRequestVar])) $tag = $_REQUEST[$tagRequestVar];
}
if (empty($album) && empty($tag)) return '';
/* build query */
$tagc = $modx->newQuery('galTag');
$tagc->setClassAlias('TagsJoin');
$tagc->select('GROUP_CONCAT('.$modx->getSelectColumns('galTag','TagsJoin','',array('tag')).')');
$tagc->where($modx->getSelectColumns('galTag','TagsJoin','',array('item')).' = '.$modx->getSelectColumns('galItem','galItem','',array('id')));
$tagc->prepare();
$tagSql = $tagc->toSql();
$c = $modx->newQuery('galItem');
$c->innerJoin('galAlbumItem','AlbumItems');
$c->innerJoin('galAlbum','Album',$modx->getSelectColumns('galAlbumItem','AlbumItems','',array('album')).' = '.$modx->getSelectColumns('galAlbum','Album','',array('id')));
/* pull by album */
if (!empty($album)) {
$albumField = is_numeric($album) ? 'id' : 'name';
$albumWhere = $albumField == 'name' ? array('name' => $album) : $album;
/** @var galAlbum $album */
$album = $modx->getObject('galAlbum',$albumWhere);
if (empty($album)) return '';
$c->where(array(
'Album.'.$albumField => $album->get($albumField),
));
$galleryId = $album->get('id');
$galleryName = $album->get('name');
$galleryDescription = $album->get('description');
unset($albumWhere,$albumField);
}
if (!empty($tag)) { /* pull by tag */
$c->innerJoin('galTag','Tags');
$c->where(array(
'Tags.tag' => $tag,
));
if (empty($album)) {
$galleryId = 0;
$galleryName = $tag;
$galleryDescription = '';
}
}
$c->where(array(
'galItem.mediatype' => $modx->getOption('mediatype',$scriptProperties,'image'),
));
if (!$showInactive) {
$c->where(array(
'galItem.active' => true,
));
}
$count = $modx->getCount('galItem',$c);
$c->select(array('galItem.*'));
$c->select(array(
'('.$tagSql.') AS `tags`'
));
if (strcasecmp($sort,'rand')==0) {
$c->sortby('RAND()',$dir);
} else {
$c->sortby($sortAlias.'.'.$sort,$dir);
}
if (!empty($limit)) $c->limit($limit,$start);
$items = $modx->getCollection('galItem',$c);
/* load plugins */
if (!empty($plugin)) {
$pluginPath = $modx->getOption('pluginPath',$scriptProperties,'');
if (empty($pluginPath)) {
$pluginPath = $gallery->config['modelPath'].'gallery/plugins/';
}
/** @var GalleryPlugin $plugin */
if (($className = $modx->loadClass($plugin,$pluginPath,true,true))) {
$plugin = new $className($gallery,$scriptProperties);
$plugin->load();
$scriptProperties = $plugin->adjustSettings($scriptProperties);
} else {
return $modx->lexicon('gallery.plugin_err_load',array('name' => $plugin,'path' => $pluginPath));
}
} else {
if ($modx->getOption('useCss',$scriptProperties,true)) {
$modx->regClientCSS($gallery->config['cssUrl'].'web.css');
}
}
/* iterate */
$output = '';
$imageProperties = $modx->getOption('imageProperties',$scriptProperties,'');
$imageProperties = !empty($imageProperties) ? $modx->fromJSON($imageProperties) : array();
$imageProperties = array_merge(array(
'w' => (int)$modx->getOption('imageWidth',$scriptProperties,500),
'h' => (int)$modx->getOption('imageHeight',$scriptProperties,500),
'zc' => (boolean)$modx->getOption('imageZoomCrop',$scriptProperties,0),
'far' => (string)$modx->getOption('imageFar',$scriptProperties,false),
'q' => (int)$modx->getOption('imageQuality',$scriptProperties,90),
),$imageProperties);
$thumbProperties = $modx->getOption('thumbProperties',$scriptProperties,'');
$thumbProperties = !empty($thumbProperties) ? $modx->fromJSON($thumbProperties) : array();
$thumbProperties = array_merge(array(
'w' => (int)$modx->getOption('thumbWidth',$scriptProperties,100),
'h' => (int)$modx->getOption('thumbHeight',$scriptProperties,100),
'zc' => (boolean)$modx->getOption('thumbZoomCrop',$scriptProperties,1),
'far' => (string)$modx->getOption('thumbFar',$scriptProperties,'C'),
'q' => (int)$modx->getOption('thumbQuality',$scriptProperties,90),
),$thumbProperties);
$idx = 0;
$filesUrl = $modx->call('galAlbum','getFilesUrl',array(&$modx));
$filesPath = $modx->call('galAlbum','getFilesPath',array(&$modx));
/** @var galItem $item */
foreach ($items as $item) {
$itemArray = $item->toArray();
$itemArray['idx'] = $idx;
$itemArray['cls'] = $itemCls;
if ($itemArray['id'] == $highlightItem) {
$itemArray['cls'] .= ' '.$activeCls;
}
$itemArray['filename'] = basename($item->get('filename'));
$itemArray['image_absolute'] = $filesUrl.$item->get('filename');
$itemArray['fileurl'] = $itemArray['image_absolute'];
$itemArray['filepath'] = $filesPath.$item->get('filename');
$itemArray['filesize'] = $item->get('filesize');
$itemArray['thumbnail'] = $item->get('thumbnail',$thumbProperties);
$itemArray['image'] = $item->get('thumbnail',$imageProperties);
if (!empty($album)) $itemArray['album'] = $album->get('id');
if (!empty($tag)) $itemArray['tag'] = $tag;
$itemArray['linkToImage'] = $linkToImage;
$itemArray['imageGetParam'] = $imageGetParam;
$itemArray['albumRequestVar'] = $albumRequestVar;
$itemArray['tagRequestVar'] = $tagRequestVar;
$itemArray['tag'] = '';
$output .= $gallery->getChunk($modx->getOption('thumbTpl',$scriptProperties,'galItemThumb'),$itemArray);
$idx++;
}
/* if set, place in a container tpl */
$containerTpl = $modx->getOption('containerTpl',$scriptProperties,false);
if (!empty($containerTpl)) {
$ct = $gallery->getChunk($containerTpl,array(
'thumbnails' => $output,
'album_name' => $galleryName,
'album_description' => $galleryDescription,
'albumRequestVar' => $albumRequestVar,
'albumId' => $galleryId,
));
if (!empty($ct)) $output = $ct;
}
/* set to placeholders or output directly */
$toPlaceholder = $modx->getOption('toPlaceholder',$scriptProperties,false);
if (!empty($toPlaceholder)) {
$modx->toPlaceholders(array(
$toPlaceholder => $output,
$toPlaceholder.'.id' => $galleryId,
$toPlaceholder.'.name' => $galleryName,
$toPlaceholder.'.description' => $galleryDescription,
$toPlaceholder.'.total' => $count,
));
} else {
$placeholderPrefix = $modx->getOption('placeholderPrefix',$scriptProperties,'gallery.');
$modx->toPlaceholders(array(
$placeholderPrefix.'id' => $galleryId,
$placeholderPrefix.'name' => $galleryName,
$placeholderPrefix.'description' => $galleryDescription,
$placeholderPrefix.'total' => $count,
));
return $output;
}
return '';
Snipet: GalleryAlbums
<?php
/**
* Gallery
*
* Copyright 2010-2012 by Shaun McCormick <
[email protected]>
*
* Gallery 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.
*
* Gallery 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
* Gallery; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package gallery
*/
/**
* Loads a list of Albums
*
* @package gallery
*/
$gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties);
if (!($gallery instanceof Gallery)) return '';
/* setup default properties */
$rowTpl = $modx->getOption('rowTpl',$scriptProperties,'galAlbumRowTpl');
$rowCls = $modx->getOption('rowCls',$scriptProperties,'');
$showInactive = $modx->getOption('showInactive',$scriptProperties,false);
$prominentOnly = $modx->getOption('prominentOnly',$scriptProperties,true);
$toPlaceholder = $modx->getOption('toPlaceholder',$scriptProperties,false);
$sort = $modx->getOption('sort',$scriptProperties,'rank');
$dir = $modx->getOption('dir',$scriptProperties,'DESC');
$limit = $modx->getOption('limit',$scriptProperties,10);
$start = $modx->getOption('start',$scriptProperties,0);
$parent = $modx->getOption('parent',$scriptProperties,0);
$showAll = $modx->getOption('showAll',$scriptProperties,false);
$albumRequestVar = $modx->getOption('albumRequestVar',$scriptProperties,'galAlbum');
$albumCoverSort = $modx->getOption('albumCoverSort',$scriptProperties,'rank');
$albumCoverSortDir = $modx->getOption('albumCoverSortDir',$scriptProperties,'ASC');
$showName = $modx->getOption('showName',$scriptProperties,true);
/* add random sorting for albums */
if (in_array(strtolower($sort),array('random','rand()','rand'))) {
$sort = 'RAND()';
$dir = '';
}
/* handle sorting for album cover */
if ($albumCoverSort == 'rank') {
$albumCoverSort = 'AlbumItems.rank';
}
if (in_array(strtolower($albumCoverSort),array('random','rand()','rand'))) {
$albumCoverSort = 'RAND()';
$albumCoverSortDir = '';
}
/* build query */
$c = $modx->newQuery('galAlbum');
if (!$showInactive) {
$c->where(array(
'active' => true,
));
}
if ($prominentOnly) {
$c->where(array(
'prominent' => true,
));
}
if (empty($showAll)) {
$c->where(array(
'parent' => $parent,
));
}
$c->sortby($sort,$dir);
if ($limit > 0) { $c->limit($limit,$start); }
$albums = $modx->getCollection('galAlbum',$c);
/* get thumb properties for album cover */
$thumbProperties = $modx->getOption('thumbProperties',$scriptProperties,'');
$thumbProperties = !empty($thumbProperties) ? $modx->fromJSON($thumbProperties) : array();
$thumbProperties = array_merge(array(
'w' => (int)$modx->getOption('thumbWidth',$scriptProperties,100),
'h' => (int)$modx->getOption('thumbHeight',$scriptProperties,100),
'zc' => (boolean)$modx->getOption('thumbZoomCrop',$scriptProperties,1),
'far' => (string)$modx->getOption('thumbFar',$scriptProperties,'C'),
'q' => (int)$modx->getOption('thumbQuality',$scriptProperties,90),
),$thumbProperties);
/* iterate */
$output = array();
$idx = 0;
foreach ($albums as $album) {
$albumArray = $album->toArray();
$c = $modx->newQuery('galItem');
$c->innerJoin('galAlbumItem','AlbumItems');
$c->where(array(
'AlbumItems.album' => $album->get('id'),
));
$c->sortby($albumCoverSort,$albumCoverSortDir);
$c->limit(1);
$coverItem = $modx->getObject('galItem',$c);
if ($coverItem) {
$albumArray['image'] = $coverItem->get('thumbnail',$thumbProperties);
}
$albumArray['cls'] = $rowCls;
$albumArray['idx'] = $idx;
$albumArray['showName'] = $showName;
$albumArray['albumRequestVar'] = $albumRequestVar;
$output[] = $gallery->getChunk($rowTpl,$albumArray);
$idx++;
}
/* set output to placeholder or return */
$outputSeparator = $modx->getOption('outputSeparator',$scriptProperties,"\n");
$output = implode($outputSeparator,$output);
if ($toPlaceholder) {
$modx->setPlaceholder($toPlaceholder,$output);
return '';
}
return $output;
Snipet: GalleryItem
<?php
/**
* Gallery
*
* Copyright 2010-2012 by Shaun McCormick <
[email protected]>
*
* Gallery 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.
*
* Gallery 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
* Gallery; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package gallery
*/
/**
* Display a single Gallery Item
*
* @package gallery
*/
$gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties);
if (!($gallery instanceof Gallery)) return '';
/* get ID of item */
$id = (int)$modx->getOption('id',$scriptProperties,false);
if ($modx->getOption('checkForRequestVar',$scriptProperties,true)) {
$getParam = $modx->getOption('getParam',$scriptProperties,'galItem');
if (!empty($_REQUEST[$getParam])) { $id = (int)$_REQUEST[$getParam]; }
}
if (empty($id)) return '';
/* setup default properties */
$tpl = $modx->getOption('tpl',$scriptProperties,'galItem');
$toPlaceholders = $modx->getOption('toPlaceholders',$scriptProperties,true);
$toPlaceholdersPrefix = $modx->getOption('toPlaceholdersPrefix',$scriptProperties,'galitem');
$albumTpl = $modx->getOption('albumTpl',$scriptProperties,'galItemAlbum');
$albumSeparator = $modx->getOption('albumSeparator',$scriptProperties,', ');
$albumRequestVar = $modx->getOption('albumRequestVar',$scriptProperties,'galAlbum');
$tagTpl = $modx->getOption('tagTpl',$scriptProperties,'galItemTag');
$tagSeparator = $modx->getOption('tagSeparator',$scriptProperties,', ');
$tagSortDir = $modx->getOption('tagSortDir',$scriptProperties,'DESC');
$tagRequestVar = $modx->getOption('tagRequestVar',$scriptProperties,'galTag');
/* get item */
$c = $modx->newQuery('galItem');
$c->select($modx->getSelectColumns('galItem','galItem'));
$c->where(array(
'id' => $id,
));
$item = $modx->getObject('galItem',$c);
if (empty($item)) return '';
/* setup placeholders */
$itemArray = $item->toArray();
$itemArray['filename'] = basename($item->get('filename'));
$itemArray['filesize'] = $item->get('filesize');
/* get image+thumbnail */
$thumbProperties = $modx->getOption('thumbProperties',$scriptProperties,'');
$thumbProperties = !empty($thumbProperties) ? $modx->fromJSON($thumbProperties) : array();
$thumbProperties = array_merge(array(
'w' => (int)$modx->getOption('thumbWidth',$scriptProperties,100),
'h' => (int)$modx->getOption('thumbHeight',$scriptProperties,100),
'zc' => (boolean)$modx->getOption('thumbZoomCrop',$scriptProperties,0),
'far' => (string)$modx->getOption('thumbFar',$scriptProperties,'C'),
'q' => (int)$modx->getOption('thumbQuality',$scriptProperties,90),
),$thumbProperties);
$itemArray['thumbnail'] = $item->get('thumbnail',$thumbProperties);
$imageProperties = $modx->getOption('imageProperties',$scriptProperties,'');
$imageProperties = !empty($imageProperties) ? $modx->fromJSON($imageProperties) : array();
$imageProperties = array_merge(array(
'w' => (int)$modx->getOption('imageWidth',$scriptProperties,500),
'h' => (int)$modx->getOption('imageHeight',$scriptProperties,500),
'zc' => (boolean)$modx->getOption('imageZoomCrop',$scriptProperties,0),
'far' => (string)$modx->getOption('imageFar',$scriptProperties,false),
'q' => (int)$modx->getOption('imageQuality',$scriptProperties,90),
),$imageProperties);
$itemArray['image'] = $item->get('thumbnail',$imageProperties);
/* get albums */
$c = $modx->newQuery('galAlbum');
$c->innerJoin('galAlbumItem','AlbumItems',$modx->getSelectColumns('galAlbumItem','AlbumItems','',array('album')).' = '.$modx->getSelectColumns('galAlbum','galAlbum','',array('id'))
.' AND '.$modx->getSelectColumns('galAlbumItem','AlbumItems','',array('item')).' = '.$item->get('id'));
$c->sortby('AlbumItems.rank','ASC');
$albums = $modx->getCollection('galAlbum',$c);
$itemArray['albums'] = array();
$i = 0;
foreach ($albums as $album) {
$albumArray = $album->toArray('',true,true);
$albumArray['idx'] = $i;
$albumArray['albumRequestVar'] = $albumRequestVar;
$itemArray['albums'][] = $gallery->getChunk($albumTpl,$albumArray);
$i++;
}
$itemArray['albums'] = implode($albumSeparator,$itemArray['albums']);
/* get tags */
$c = $modx->newQuery('galTag');
$c->where(array(
'item' => $item->get('id'),
));
$c->sortby('tag',$tagSortDir);
$tags = $modx->getCollection('galTag',$c);
$i = 0;
$itemArray['tags'] = array();
foreach ($tags as $tag) {
$tagArray = $tag->toArray();
$tagArray['idx'] = $i;
$tagArray['tagRequestVar'] = $tagRequestVar;
$itemArray['tags'][] = $gallery->getChunk($tagTpl,$tagArray);
$i++;
}
$itemArray['tags'] = implode($tagSeparator,$itemArray['tags']);
/* if outputting to placeholders, use this, otherwise, use tpl */
if ($toPlaceholders) {
$modx->toPlaceholders($itemArray,$toPlaceholdersPrefix);
return '';
}
if (empty($tpl)) return '';
$output .= $gallery->getChunk($tpl,$itemArray);
return $output;
[ed. note: rexina last edited this post 14 years, 4 months ago.]