For a site builder/coder like me, editing the slideshow is fairly trivial, but for a client/user this would be impossible. This is a great looking theme and I see you are doing work on it. Thanks for releasing it. I am trying it out for an e-commerce store.

What would be the chances of implementing a slideshow interface to the theme itself, similar to http://drupal.org/project/marinelli

This would enable clients to change the images and text on their slideshow very easily.

I made this a new issue instead of adding to this one: http://drupal.org/node/1219684 because this is a feature request and I suspect others may want it as well.

Comments

KirstenLangholz’s picture

I would love this feature, too. Since my customers also would like to change the slideshow settings by themselves frequently.

damiandab’s picture

Look my post about views slideshow: http://drupal.org/node/1219684

I hope it will help.

bhosmer’s picture

Right, but to allow a simple site user to do this would be disastrous. I understand and can update the slideshow, but it would be a great feature and addition to the theme if site managers were able to upload their own images and add them to the theme easily, which was the idea behind my original feature request.

damiandab’s picture

You can always create content type slideshow and give site manager permission to edit it. "Views slideshow" is set by you and site manager doesn't have to see it. With content type the system is more flexible, you can add to image field effects like imagecache actions or image cropping, so the images will be processed directly on the server and site manager doesn't have to carry about preparation of images (size, dimension, underlay, watermark).

Giving permission the site manager to theme settings isn't good idea, in theme settings you have logo upload, favicon upload and another presets that site manager or editor shouldn't see.

bhosmer’s picture

Have you seen how Marinelli does this? It works in a similar fashion where a simple user can change the slide show.

It would be a nice addition to this great looking theme.

TonyAngelo’s picture

I have used damiandab's method and it works great. As he said, in Marinelli the end user would need access to the theme to be able to change the slideshow content. Using his method they only need to be able to create right content type.

program3r’s picture

Component: User interface » Code
Assigned: Unassigned » program3r
Category: feature » task
StatusFileSize
new188.15 KB

I wrote a replacement for the slideshow.php if anyone is interested. It allows people to change the slides based on having a specific role. It also makes sure the user cant delete the last slide. I wrote it for a customer of mine and would be willing to hand it out since people need it. I just threw this image together real quick. It's not the best but its all I had time for, just be glad for free code.

<?php   
function Permit(){
	global $user;
	if (in_array('administrator', $user->roles)) {
     		return true;
	}else{
		return false;
	}
}
function QueryDB($id,$type,$extra){
	mysql_connect("localhost","USERNAME","PASSWORD");
	@mysql_select_db('DATABASE') or die( "Unable to select database");
	switch ($type) {
    		case 'SELECT':
        		$query="SELECT * FROM gallery";
			$calculated_query = true;
			break;
		case 'DELETE':
				$query = "DELETE FROM gallery";
			break;
		case 'UPDATE':
			$updates = explode("|", $extra);
			$query = "UPDATE gallery SET";
			foreach ($updates as &$update) {
    				$value = explode("=", $update);
				$InfoType = $value[0];
				switch ($InfoType) {
					case '[POST]':
						$posted = $_POST[$value[2]];
						break;
					case '[FILE]':
						$path = substr(base_path().drupal_get_path('theme', 'corporateclean')."/mockup/", 1);
						$posted = $_FILES[$value[2]]["name"];
						move_uploaded_file($_FILES[$value[2]]["tmp_name"],$path.$_FILES[$value[2]]["name"]);
						break;
				}
				
				$filtered = mysql_real_escape_string($posted);
				$query = $query." ".$value[1]."='".$filtered."',";
			}
			break;
		case 'INSERT':
			$updates = explode("|", $extra);
			$query = "INSERT INTO gallery";
			foreach ($updates as &$update) {
    				$value = explode("=", $update);
				$InfoType = $value[0];
				switch ($InfoType) {
					case '[POST]':
						$posted = $_POST[$value[2]];
						break;
					case '[FILE]':
						$path = substr(base_path().drupal_get_path('theme', 'corporateclean')."/mockup/", 1);
						$posted = $_FILES[$value[2]]["name"];
						move_uploaded_file($_FILES[$value[2]]["tmp_name"],$path.$_FILES[$value[2]]["name"]);
						break;
				}
				
				$filtered = mysql_real_escape_string($posted);
				//$query = $query." ".$value[1]."='".$filtered."',";
				$columns = $columns.$value[1].", ";
				$values = $values."'".$filtered."', ";
			}
			$values = substr($values,0,-2);
			$columns = substr($columns,0,-2);
			$id = "ALL";
			$query = $query." (".$columns.") VALUES (".$values.")";
			break;
	}
	if($id != "ALL"){
		$query = $query." WHERE id='".$id."'";
	}
	if($calculated_query){
		$query = $query." ORDER BY id desc";
	}
	$query = str_replace(", WHERE", " WHERE", $query);
	$results = mysql_query($query);
	mysql_close();
	//echo $query;    SHOW EACH QUERY ON THE PAGE
	return $results;
}
?>
<!--slideshow-->
    <div id="slideshow">
    

<?
$mode = $_GET['mode'];
$id_num = $_GET['id'];
if($mode == 'editslideshow' && Permit() && $id_num > ""){


$gallery_result = QueryDB($id_num, "SELECT","");
$rows = mysql_numrows($gallery_result);
if($rows > 0){
	$i=0;
	while ($i < $rows) {
	
	$item_id=mysql_result($gallery_result,$i,"id");
	$item_link=mysql_result($gallery_result,$i,"link_location");
	$item_desc=mysql_result($gallery_result,$i,"description");
	$item_main=mysql_result($gallery_result,$i,"main_title");
	$item_sub=mysql_result($gallery_result,$i,"sub_title");
	$item_title3=mysql_result($gallery_result,$i,"title3");
	$item_image=mysql_result($gallery_result,$i,"image_loc");
?>
       <!--slider-item-->
        <div class="slider-item">
            <div class="content">
<form action="/?mode=submitslideshow&id=<? echo $id_num; ?>" method="post" id="slideshow<? echo $id_num; ?>" name="slideshow<? echo $id_num; ?>" enctype="multipart/form-data">
                <!--slider-item content-->
		  <table>
                <tr><td>Main Title:</td><td><input type="text" name="title" value="<? echo $item_main; ?>"></td></tr>
                <tr><td>Sub Title:</td><td><input type="text" name="title2" value="<? echo $item_sub; ?>"></td></tr>
                <tr><td>Title 3:</td><td><input type="text" name="title3" value="<? echo $item_title3; ?>"></td></tr>
		  <tr><td>URL:</td><td><input type="text" name="link" value="<? echo $item_link; ?>"></td></tr>
		  <tr><td>Image:</td><td><input type="file" name="image" value="<?php print base_path() . drupal_get_path('theme', 'corporateclean') ;?>/mockup/<? echo $item_image; ?>"></td></tr>
                <tr><td>Description:</td><td>
		  <textarea name="content" rows="7" cols="100"><? echo $item_desc; ?></textarea></td></tr>
                <tr><td></td><td><div style="display:block; padding:30px 0 10px 0;"><a class="more" href="#" onclick="document.forms['slideshow<? echo $id_num; ?>'].submit();">Submit</a></div></td></tr>
                <!--EOF:slider-item content-->
                </table>
            </div>
        </div>
        <!--EOF:slider-item-->
</form>


<? 

		$i++;
	}
}else{
?>
       <!--slider-item-->
        <div class="slider-item">
            <div class="content">
	<form action="/?mode=addslideshow&id=0" method="post" id="slideshownew" name="slideshownew" enctype="multipart/form-data">
                <!--slider-item content-->
		  <table>
                <tr><td>Main Title:</td><td><input type="text" name="title" value="New Slideshow Item"></td></tr>
                <tr><td>Sub Title:</td><td><input type="text" name="title2"></td></tr>
                <tr><td>Title 3:</td><td><input type="text" name="title3"></td></tr>
		  <tr><td>URL:</td><td><input type="text" name="link"></td></tr>
		  <tr><td>Image:</td><td><input type="file" name="image"></td></tr>
                <tr><td>Description:</td><td>
		  <textarea name="content" rows="7" cols="100"></textarea></td></tr>
                <tr><td></td><td><div style="display:block; padding:30px 0 10px 0;"><a class="more" href="#" onclick="document.forms['slideshownew'].submit();">Submit</a></div></td></tr>
                <!--EOF:slider-item content-->
                </table>
            </div>
        </div>
        <!--EOF:slider-item-->
</form>
<?
}
}else if($mode == 'submitslideshow' && Permit() && $id_num > ""){

QueryDB($id_num, "UPDATE", "[POST]=main_title=title|[POST]=sub_title=title2|[POST]=title3=title3|[POST]=link_location=link|[FILE]=image_loc=image|[POST]=description=content");



	?>
		<script>alert('Slide Updated');window.location='/';</script>
	<?
}else if($mode == 'deleteslide' && Permit() && $id_num > 0){

	QueryDB($id_num, "DELETE", "");
	?>
		<script>alert('Slide Deleted');window.location='/';</script>
	<?
}else if($mode == 'addslideshow' && Permit()){
	QueryDB($id_num, "INSERT", "[POST]=main_title=title|[POST]=sub_title=title2|[POST]=title3=title3|[POST]=link_location=link|[FILE]=image_loc=image|[POST]=description=content");

	?>
		<script>alert('Slide Added');window.location='/';</script>
	<?
}else{ 

$gallery_result = QueryDB("ALL", "SELECT","");
$rows = mysql_numrows($gallery_result);
if($rows > 0){
	$i=0;
	while ($i < $rows) {
	
	$item_id=mysql_result($gallery_result,$i,"id");
	$item_link=mysql_result($gallery_result,$i,"link_location");
	$item_desc=mysql_result($gallery_result,$i,"description");
	$item_main=mysql_result($gallery_result,$i,"main_title");
	$item_sub=mysql_result($gallery_result,$i,"sub_title");
	$item_title3=mysql_result($gallery_result,$i,"title3");
	$item_image=mysql_result($gallery_result,$i,"image_loc");
?>

        <!--slider-item-->
        <div class="slider-item">
            <div class="content">
                
                <!--slider-item content-->
                <div style="float:left; padding:0 30px 0 0;">
                <img height="250px" class="masked" src="<?php print base_path() . drupal_get_path('theme', 'corporateclean') ;?>/mockup/<? echo $item_image; ?>"/>
                </div>
                <h2><? echo $item_main; ?></h2>
                <strong><? echo $item_sub; ?></strong><br/>
                <em><? echo $item_title3; ?></em><br/>
                <br/>
                <? echo $item_desc; ?>
                <div style="display:block; padding:30px 0 10px 0;"><a class="more" href="<? echo $item_link; ?>">Tell me more</a><? if(Permit()){ ?><a class="more" href="/?mode=editslideshow&id=<? echo $item_id; ?>" style="margin-left:5px;">Edit</a><? } ?><? if(Permit()){ ?><a class="more" href="/?mode=editslideshow&id=0" style="margin-left:5px;">Add New</a><? } ?><? if(Permit() && $rows > 1){ ?><a class="more" href="/?mode=deleteslide&id=<? echo $item_id; ?>" style="margin-left:5px;">Delete</a><? } ?></div>
                <!--EOF:slider-item content-->
                
            </div>
        </div>
        <!--EOF:slider-item-->


<?
			$i++;
		}
	}

}
 ?>


    </div>
    <!--EOF:slideshow-->
    
    <!--slider-controls-wrapper-->
    <div id="slider-controls-wrapper">
        <div id="slider-controls">
            <ul id="slider-navigation">
<?
if(isset($rows)){
	if($rows > 0){
		$i=0;
		while ($i < $rows) {
 	               ?><li><a href="#"></a></li><?
			$i++;
		}
	}
}
?>
            </ul>
        </div>
    </div>
    <!--EOF:slider-controls-wrapper-->
masala-1’s picture

Hi program3r. This looks very promising and useful indeed. Thanks for sharing your hard work.

However, I am not too sure where to implement it? I had a quick search through for a slideshow.php in the corporate clean theme folders but couldn't find anything. Sorry if I am missing something obvious. As you can probably tell I am a complete PHP novice!

otcassetmgmt’s picture

I am in the same boat not sure how to implement this code do I need to create a module and hook into the menu system? I am very weak on theme coding.

alexandreracine’s picture

Status: Active » Closed (fixed)

Is this corrected in the latest version? Let us know if not. Closing for now.

bhosmer’s picture

Status: Closed (fixed) » Needs work

@alexandreracine I think you are a little quick here closing issues out.

No, this hasn't been fixed, at least with 7.x-2.2.

stewarta’s picture

I don't think this issue is actually closed alexandreracine.

FreeXenon’s picture

Issue summary: View changes

Yea, I would like a way to change the slideshow. Having it show sample content is not so useful.
Like the others said, a theme based interface would be good, or just giving a theme option to remove it altogether, and have that area set up as a region so we can add a views slideshow. Perhaps have an option to disable the slideshow CSS too incase that region will not be used that way.

shulmda’s picture

I spent some time on this and the post from program3r was EXTREMELY helpful it getting started. There are a few things that you need to allow for if you want to do this. 1st, you need to create a gallery table in your database. program3r didn't mention this, but considering how helpful the code is, it is easily forgiven. It is bit clearer if you look at the code. Here is a sample database creation DDL that I created. Please note that I added some columns for language and and weight support so that you can control the language and the order of the slider items. There isn't a provision for the "Style" of the slider items (I don't need it, sorry). Also, you should note that the code that program3r was written for an earlier version of Drupal. The database connection mode in Drupal 7 is different. 3rd, people are wondering where the slideshow file goes. Well, I figured that out, it goes INSIDE of page.tpl.php between

PLEASE do not simply copy and paste the code and expect it to work. I had to do some major surgery to get it working in Drupal 7. However, thanks to program3r I had a HUGE head start.

CREATE TABLE `gallery` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`link_location` varchar(255) NOT NULL DEFAULT '',
`description` varchar(2000) NOT NULL DEFAULT '',
`main_title` varchar(255) NOT NULL DEFAULT '',
`sub_title` varchar(255) NOT NULL DEFAULT '',
`title3` varchar(255) NOT NULL DEFAULT '',
`image_loc` varchar(255) NOT NULL DEFAULT '',
`language` varchar(255) NOT NULL DEFAULT '',
`weight` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

shulmda’s picture

Sorry, it seems that in my comment, the between is getting cut off. The code should be between (hash)slideshow and EOF: (hash) slider-controls-wrapper

denisvs’s picture

StatusFileSize
new2.26 KB
new35.59 KB

This is a my variant of the edited by user slider.
You should create the new content type with name "slider".
Next, add new fields inside it:

Fields of the slider content type

slider_alignment field settings are:
On value = Right
Off value = Left

Now you should download archive page.tpl_.php_.tgz and extract content to theme directory, over file page.tpl.php.
Using of the mod is very simple.
Just add new node with "slider" content type.
Field "field_slider_link" should consist the link to the target url, e.g.: "node/2".
"field_slider_link_text" is a text for slider button.
"field_slider_alignment" determines position of image in slider.

denisvs’s picture

StatusFileSize
new7.09 KB

This is a patch.

tropicalman59’s picture

I used Dennis approach, but also added a field to determine if the link should open in a new page.

"slider link action" field_slider_link_action List (text) Check boxes/radio buttons

Allowed Values list
_blank|New Page
_self|Current Page

Then I modified the page.tpl.php to add target to the anchor:

 $sliderLink = field_get_items('node', $node, 'field_slider_link');  // get whole link field
  $sliderLinkText = field_get_items('node', $node, 'field_slider_link_text');  // get whole link text field
  $sliderAlignment = field_get_items('node', $node, 'field_slider_alignment');  // get whole alignment field

// New line added
 $sliderTarget = field_get_items('node', $node, 'field_slider_link_action');

  if ($sliderAlignment[0]['value'] == 0) {
?>
        <!--slider-item-->
        <div class="slider-item">
            <div class="content container_12">
            	<div class="grid_12">
                <!--slider-item content-->
                <div style="float:left; padding:0 30px 0 0;">
                <!-- img class="masked" src="< ?php print render($sliderFileUrl); ?>"/ -->
                <img class="masked" src="<?php print render($sliderFileUrl); ?>"/>
                </div>
                <h2><?php print $node->title;?></h2>
                <?php print $sliderBody[0]['value'] ?>
<!-- modified the anchor below to add target -->
                <div style="display:block; padding:30px 0 10px 0;"><a class="more"<strong> target="<?php print ($sliderTarget[0]['value']); ?>" </strong>href="<?php print  ($sliderLink[0]['value']); ?>"><?php print  ($sliderLinkText[0]['value']); ?></a></div>
                <!--EOF:slider-item content-->
                </div>
            </div>
        </div>
        <!--EOF:slider-item-->
avpaderno’s picture

Version: 7.x-1.0 » 7.x-1.7
Assigned: program3r » Unassigned
Status: Needs work » Needs review