Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Category Node
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Gallery
|
||||
* @since 04 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\gallery;
|
||||
@@ -24,6 +23,8 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
use \IPS\Content\ClubContainer;
|
||||
|
||||
/**
|
||||
* @brief [ActiveRecord] Multiton Store
|
||||
*/
|
||||
@@ -152,7 +153,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
*/
|
||||
public function get__sortBy()
|
||||
{
|
||||
return $this->sort_options;
|
||||
return str_replace( 'album_', '', $this->sort_options );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,7 +287,16 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
return !isset( \IPS\Request::i()->id ) or ( $node->id != \IPS\Request::i()->id and !$node->isChildOf( $node::load( \IPS\Request::i()->id ) ) );
|
||||
}
|
||||
) ) );
|
||||
$sortoptions = array( 'album_last_img_date' => 'sort_updated', 'album_name' => 'sort_title', 'album_rating_aggregate' => 'sort_rating', 'album_count_comments' => 'sort_num_comments', 'album_count_images' => 'sort_count_imgs' );
|
||||
$sortoptions = array(
|
||||
'album_last_img_date' => 'sort_updated',
|
||||
'album_last_comment' => 'sort_last_comment',
|
||||
'album_rating_aggregate' => 'sort_rating',
|
||||
'album_comments' => 'sort_num_comments',
|
||||
'album_reviews' => 'sort_num_reviews',
|
||||
'album_name' => 'sort_album_name',
|
||||
'album_count_comments' => 'sort_album_count_comments',
|
||||
'album_count_imgs' => 'sort_album_count_imgs'
|
||||
);
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'category_sort_options', $this->sort_options ?: 'updated', FALSE, array( 'options' => $sortoptions ), NULL, NULL, NULL, 'category_sort_options' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'category_allow_albums', $this->id ? $this->allow_albums : TRUE, FALSE ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'category_approve_img', $this->approve_img, FALSE ) );
|
||||
@@ -361,6 +371,12 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
unset( $values['gcategory_parent_id'] );
|
||||
}
|
||||
|
||||
/* If watermarks are disabled, enable them at the category level so that if you later enable watermarks they work in your existing categories */
|
||||
if( !\IPS\Settings::i()->gallery_watermark_path )
|
||||
{
|
||||
$values['category_watermark']= 1;
|
||||
}
|
||||
|
||||
/* Claim attachments */
|
||||
if ( !$this->id )
|
||||
{
|
||||
@@ -603,6 +619,11 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( $size == 'full' )
|
||||
{
|
||||
$size = 'masked';
|
||||
}
|
||||
|
||||
$property = $size . "_file_name";
|
||||
|
||||
@@ -616,16 +637,11 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( !in_array( $size, array( 'full', 'medium', 'small', 'thumb' ) ) )
|
||||
if( !in_array( $size, array( 'masked', 'medium', 'small', 'thumb' ) ) )
|
||||
{
|
||||
throw new \InvalidArgumentException;
|
||||
}
|
||||
|
||||
if( $size == 'full' )
|
||||
{
|
||||
$size = 'masked';
|
||||
}
|
||||
|
||||
if( $this->coverPhoto === NULL )
|
||||
{
|
||||
$this->coverPhoto = \IPS\gallery\Image::load( $this->cover_img_id );
|
||||
@@ -721,10 +737,9 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
* Handle submissions of form to delete or move content
|
||||
*
|
||||
* @param array $values Values from form
|
||||
* @param bool $deleteWhenDone Delete the node when done?
|
||||
* @return void
|
||||
*/
|
||||
public function deleteOrMoveFormSubmit( $values, $deleteWhenDone=TRUE )
|
||||
public function deleteOrMoveFormSubmit( $values )
|
||||
{
|
||||
if ( $this->hasAlbums() )
|
||||
{
|
||||
@@ -736,7 +751,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'DeleteOrMoveContent', array( 'class' => 'IPS\gallery\Album', 'id' => $album->_id, 'deleteWhenDone' => $deleteWhenDone ) );
|
||||
\IPS\Task::queue( 'core', 'DeleteOrMoveContent', array( 'class' => 'IPS\gallery\Album', 'id' => $album->_id, 'deleteWhenDone' => TRUE ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -819,4 +834,55 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
return 'x';
|
||||
}
|
||||
|
||||
|
||||
/* !Clubs */
|
||||
|
||||
/**
|
||||
* Get acp language string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function clubAcpTitle()
|
||||
{
|
||||
return 'editor__gallery_Categories';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set form for creating a node of this type in a club
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Form object
|
||||
* @return void
|
||||
*/
|
||||
public function clubForm( \IPS\Helpers\Form $form )
|
||||
{
|
||||
$itemClass = static::$contentItemClass;
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'club_node_name', $this->_id ? $this->_title : \IPS\Member::loggedIn()->language()->addToStack( $itemClass::$title . '_pl' ), TRUE, array( 'maxLength' => 255 ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Editor( 'club_node_description', $this->_id ? \IPS\Member::loggedIn()->language()->get( static::$titleLangPrefix . $this->_id . '_desc' ) : NULL, FALSE, array( 'app' => 'gallery', 'key' => 'Categories', 'autoSaveKey' => ( $this->id ? "gallery-cat-{$this->id}" : "gallery-new-cat" ), 'attachIds' => $this->id ? array( $this->id, NULL, 'description' ) : NULL, 'minimize' => 'cdesc_placeholder' ) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'category_allow_albums', $this->id ? $this->allow_albums : TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'category_allow_comments', $this->id ? $this->allow_comments : TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'category_allow_reviews', $this->id ? $this->allow_reviews : FALSE ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class-specific routine when saving club form
|
||||
*
|
||||
* @param \IPS\Member\Club $club The club
|
||||
* @param array $values Values
|
||||
* @return void
|
||||
*/
|
||||
public function _saveClubForm( \IPS\Member\Club $club, $values )
|
||||
{
|
||||
$this->allow_albums = $values['category_allow_albums'];
|
||||
$this->allow_comments = $values['category_allow_comments'];
|
||||
$this->allow_reviews = $values['category_allow_reviews'];
|
||||
$this->can_tag = TRUE;
|
||||
$this->tag_prefixes = TRUE;
|
||||
|
||||
if ( $values['club_node_name'] )
|
||||
{
|
||||
$this->name_seo = \IPS\Http\Url\Friendly::seoTitle( $values['club_node_name'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user