CMS MADE SIMPLE FORGE

Album

 

[#5752] ContentType / Notices / Smarty in comments

avatar
Created By: Carsten Wiedmann (wiedmann)
Date Submitted: Thu Nov 25 04:06:23 -0500 2010

Assigned To:
Version: v1.1
CMSMS Version: None
Severity: Minor
Resolution: None
State: Open
Summary:
ContentType / Notices / Smarty in comments
Detailed Description:
- with a current CMSMS the ContentType is not registered
- there are some notices because of undeclared vars
- it's not possible to use smarty tags in album/picture comments


History

Comments
avatar
Date: 2010-11-25 04:06
Posted By: Carsten Wiedmann (wiedmann)

Index:
/home/cwiedmann/public_html/cmsmadesimple-dev/modules/Album/classes/module/class.Album.php
===================================================================
---
/home/cwiedmann/public_html/cmsmadesimple-dev/modules/Album/classes/module/class.Album.php
(Revision 347)
+++
/home/cwiedmann/public_html/cmsmadesimple-dev/modules/Album/classes/module/class.Album.php
(Arbeitskopie)
@@ -36,6 +36,12 @@
// An array of links (like first, last, next, previous) for Albums, Pictures,
and Thumbnail Pages

 	var $link;

 

+	function __construct()

+	{

+		parent::__construct();

+        $this->RegisterContentType('AlbumContent', dirname(__FILE__) .
DIRECTORY_SEPARATOR . 'class.AlbumContent.php', $this->GetFriendlyName());

+	}

+

 	function GetName() {return 'Album';}

 	function GetFriendlyName() {return $this->Lang('friendlyname');}

 	function GetVersion() {	return '1.0-beta1'; }

@@ -82,7 +88,6 @@
 

       // For viewing a thumbnail page

$this->RegisterRoute('/(?P<pagealias>[a-z-\/_0-9]+)\/album-(?P<albumid>[0-9]+)\/page(?P<page>[0-9]+)\/(?P<returnid>[0-9]+)$/',
array('action'=>'default'));

-	  $this->RegisterContentType('AlbumContent', dirname(__FILE__) .
DIRECTORY_SEPARATOR . 'class.AlbumContent.php', $this->GetFriendlyName());

 	  

     }

     

@@ -721,10 +726,21 @@
 		{

 			$the_albums[0] = $this->albums[$album_index];

 			$templatename  = $this->albums[$album_index]->template;

+			if (!empty($the_albums[0]->comment))

+			{

+				$the_albums[0]->comment =
$this->ProcessTemplateFromData($the_albums[0]->comment);

+			}

 			$this->smarty->assign_by_ref('albums', $the_albums);

 		}

 		else

 		{

+			foreach($this->albums as $albumkey => $onealbum)

+			{

+				if (!empty($onealbum->comment))

+                {

+				    $this->albums[$albumkey]->comment =
$this->ProcessTemplateFromData($onealbum->comment);

+				}

+			}

 			$this->smarty->assign_by_ref('albums', $this->albums);

 		}

 		$this->smarty->assign('albumcount', count($this->albums));

@@ -764,7 +780,7 @@
$albumbacklink = $this->CreateLink($id, 'default', $returnid, '',
array('albumid'=>$albumid), '', true, false, '', false,
$hierarchy_path.'/album-'.$albumid.'/'.$returnid);

 		$this->smarty->assign_by_ref('albumbacklink', $albumbacklink);

 		

-		if (!isset($params['albums']))

+		if ($albumid!='')

 		{

$this->smarty->assign('returnlink',$this->CreateReturnLink($id, $returnid,
'', array(), true));

 		}

@@ -841,7 +857,7 @@
function SetupAlbumContent($album_index, $pictureid, $hierarchy_path,
$albumid, $id, $returnid, $page, $params)

 	{

 		$currentpicture_index = 0;

-		$allpictures = $this->GetPictures($albumid, $params['sortpicturesdesc']);

+		$allpictures = $this->GetPictures($albumid,
(isset($params['sortpicturesdesc']) ? $params['sortpicturesdesc'] : false));

 		if (0 == count($allpictures))

 		{

 			echo '<b>'.$this->Lang('nopicturetext').'</b>';

@@ -905,6 +921,25 @@
 			

 			$pictures[] = $row;

 			

+			foreach ($pictures as $picturesrowkey => $onepicturesrow)

+            {

+                foreach($onepicturesrow as $pictureskey => $onepicture)

+                {

+        			if (!empty($onepicture->comment))

+                    {

+        			    $pictures[$picturesrowkey][$pictureskey]->comment =
$this->ProcessTemplateFromData($onepicture->comment);

+        			}

+        			if (!empty($onepicture->comment2))

+                    {

+        			    $pictures[$picturesrowkey][$pictureskey]->comment2 =
$this->ProcessTemplateFromData($onepicture->comment2);

+        			}

+        			if (!empty($onepicture->comment3))

+                    {

+        			    $pictures[$picturesrowkey][$pictureskey]->comment3 =
$this->ProcessTemplateFromData($onepicture->comment3);

+        			}

+        		}

+        	}

+

 			// This extra copy of the var is needed to fix the picture count bug 

 			$allthepictures = $allpictures;

 			$tpl_current_picture = new StdClass();


      
Updates

Updated: 2010-12-09 17:50
resolution_id: 11 => 5

Updated: 2010-11-25 04:06
resolution_id: => 11