Good use of Global Scrapbook?

Permalink
When we have built Concrete5 sites in the past; hard coded secondary navigation, header info, footer, etc is put in the theme.

On the last site, I decided to put those items in the page defaults, but using the Global Scrapbook.

What this gives me is the ability for a NON programmer to easily make a change in those areas through out the website without the need to go into the theme. They just go to the Global Scrapbook and make a change and it updates all instances of it.

Does anyone see any disadvantages of doing something like this? It is rare that these areas change, but in the event that it does, a non programmer can quickly make the change, and at first sight it looks to be a slick solution.

This is a question for the Core Team:
Is there any thought of adding the ability to add a previously built block to the Global Scrapbook. Right now it only gives you the ability to add it to the Default Scrapbook. If you want to add a Global block you have to recreate it by going to the Dashboard, Scrapbook, Global, Add New.

Thanks.

nolmscheid
 
frz replied on at Permalink Reply
frz
It's almost as if you had called me on the phone and demanded this feature, isn't it? ;)

Yeah you've got it right... Adding something from your scrapbook to globals is an interesting idea, perhaps in 5.4. I think we're adding a way to apply a custom template to the blocks in global scrapbook in 5.3.1 because as someone else pointed out it's kinda useless in a lot of cases without it.
oliwarner replied on at Permalink Reply
oliwarner
$b = Block::getByName('header-nav');
$b->display('templates/header_nav');


The documentation is the thing that needs to catch up because I had to hack my way through the code to find out I could do that.
nolmscheid replied on at Permalink Reply
nolmscheid
Did I really demand!? ;-)

It did turn out well though. It was not a big issue to just go into the global scrapbook and recreate a block that I had, but it would have been handy to just click on it and Add to Global Scrapbook.
chameleon replied on at Permalink Reply
Is there a way to create a scrap book item that is not globally updated?

Here's my scenario:
I’m building out a site to be handed over to a company of non-coders and the goal is to have them as independent as possible. I would like them to be able to browse to a content block that is pre-populated with an html template so that they just need to put their cursor in the right cell of a table and add an image. Because I don’t have any way to anticipate how many of these tables they will need per page (they will eventually house product information) I can’t hardcode the table structure into the template. But, when I try to use the scrap book to handle this it updates across the board, so this won’t allow them to drop the product table into the “Main2” area and then edit it per product.
Please let me know if there is a way to accomplish this.

Thanks a ton in advanced!
TheRealSean replied on at Permalink Reply
TheRealSean
I thought this was possible then I realised it was an old thread :)

If you add an item to your personal scrapbook then it is not globally updated, at least I think that's the case its how I do it. When I want something like that.

I would use a global block for the areas such as navigation and the like and for an image column you can then use a local scrapbook

OR you could use the page defaults to add a dummy block to the page that they can edit on page creation. These would then be local to that page.
chameleon replied on at Permalink Reply
Hi Seanom -
Thanks for the thoughts...
but, if it's in my scrap book, can another user access that block? Where would I give them permission to see my scrapbook?

The idea is to have the client be able to find the template block, insert it if they are adding a product to the page & then edit it by filling in the image and the appropriate text within the content editor.

Let me know if there is a way to adjust the view permissions on my personal scrapbook.
thanks!
TheRealSean replied on at Permalink Reply
TheRealSean
hmm you are right in which case what about the page defaults method.

The client would need access to the page defaults if they wanted to edit the default but then the edits are made are on the actual page.

I have set up an example on our test sitehttp://demo.realnet.co.uk/index.php?cID=103...

you can login with demo and demo,

when you visit the page the top image slider is editable per page the next two are from Blocks the Global block and my Personal Block
TheRealSean replied on at Permalink Reply
TheRealSean
a quick thought you could enable advanced permissions, then lock down certain areas to allow only certain blocks to be added
chameleon replied on at Permalink Reply 1 Attachment
Right, but if it's in the page defaults they can't just insert another template...

and if they fill up the boxes that I allow for them, then they will be in the same place that we started, that they don't know how to add the needed html table.

I'm not sure at this point if this is something that concrete is capable of, but i attached a screen shot to illustrate what i was thinking of.

Let me know if you have any other ideas. I'm just really trying to keep the client away from anything that is even close to needed to code - even if it's copying and pasting a note pad file that i give them. LOL
Thanks Again!
TheRealSean replied on at Permalink Reply
TheRealSean
how about a custom block, we are having a discussion here
http://www.concrete5.org/community/forums/customizing_c5/extending-...

about extending a block but if you where to have a custom block, with an image some text.

This could be displayed within a layout or page type.

Something like the content around image, that way they could just add the block then input the details.

I cant enable advanced permissions for my demo site from here but ill have a go tomorrow to restrict the section, for now ill add the content around image block, and let you have a look at jordans custom block which could be used to create the block.

i have quickly installed the block and added a layout but you could use a custom block/template to set defaults when you create the block
chameleon replied on at Permalink Reply
That sounds very promising!

Thanks so much for looking into this!! I'll be excited to see the outcome tomorrow.

Thanks again!
jordanlev replied on at Permalink Reply
jordanlev
The custom block creator I made is perfect for this kind of situation (I run into it all the time, which is why I wanted it). I haven't put it up on the marketplace yet because I want to write some documentation first, but if you're feeling adventurous you can download it here and install it yourself:
https://github.com/jordanlev/c5_designer_content...

(scroll down that page to find the installation instructions -- it's not too difficult to do)

I've been using it for the past couple of client sites I've built and it has been amazingly useful. If you give it a try, let me know what you think, or if you want any help with it or run into any bugs or problems.

-Jordan
chameleon replied on at Permalink Reply
Well - Actually seanom, pointed me to it, so I just downloaded it and am trying it now...

one question... i tried to add a wizzywig, put what's the difference between beginning html & ending html code?

I dropped an html table into the beginning code box and hit ad, but when the wizzywig opens I don't see the table or content in it.

OH, and yes - this will be a HUGE life saver for me!!!!!
chameleon replied on at Permalink Reply
oh - and can you edit the block once it has been created? Where do you go to edit the block or delete one?

thanks!
chameleon replied on at Permalink Reply
Never mind - found the edit button on add functionality screen :)
jordanlev replied on at Permalink Reply
jordanlev
The beginning and ending HTML are for you (the designer) to constrain the style of the block -- for example, if you always want the content in the WYSIWYG editor to be floated to the right of an image, you could put <div style="float: right;"> for the opening HTML of the and </div> for the closing HTML of the WYSIWYG field, then for the image field the opening HTML could be <div style="float: left;"> and the closing HTML <div style="float: right;">.

This is really the ideal situation that I created this for -- instead of the user having to mess with the wacky TinyMCE styles, they just enter their content and you can guarantee that it will ALWAYS be surrounded by the proper HTML.

I see your point though that the label may be misleading -- it is not "default content", but rather more of like a page template for that one tiny section of the page.
chameleon replied on at Permalink Reply
Thanks for the clarification!

Sooo.... is there a way to have it work as "default content"? Can the block carry an html table that would appear when the block is added?

thats really what I am looking for.

thanks!
jordanlev replied on at Permalink Reply
jordanlev
You can't do that from the dashboard UI, but you could easily modify the generated block to include this.
After you've created the block, go to its directory (in YOURSITE/blocks/whatever), edit the "controller.php" file, and above the line where it say "public function edit() {", hit return a few times to add some blank lines, then paste in code like this:
public function add() {
   $field_name = 'field_1_wysiqyg_content'; //<-- You may need to change the field name depending on your db.xml file
   $default_content = '
   <table>
   <tr><th>Column 1</th><th>Column 2</th></tr>
   <tr><td>blah</td><td>12345</td></tr>
   <tr><td>blah</td><td>12345</td></tr></table>
   ';
   $this->set($field_name, $defualt_content);
}

Note that the 'field_1_wysiwyg_content' field name is probably different in your actual block. You'll need to scan through the rest of the controller code to see what it's called in your block (or look at the db.xml file in that same block directory, but that may be a little harder to read).

I think your idea is pretty good though, and I can see the usefulness of it. I might add it in the future (although I'd want to figure out how to do it without cluttering up the interface too much).

-Jordan
chameleon replied on at Permalink Reply
Ok, I gave that a try, but I must be missing something...

I created a new wizzywig block

handle: prods_sum
title : Product Summary Box
Editor Label: product summary

with no code in the opening or closing html slots.

then i re-uploaded the controller.php file with the following code:

<?php 
defined('C5_EXECUTE') or die("Access Denied.");
class ProdsSumBlockController extends BlockController {
   var $pobj;
   protected $btName = 'Product Summary Box';
   protected $btDescription = 'Template box for adding a product to a summary page.';
   protected $btTable = 'btProdsSum';
   protected $btInterfaceWidth = "700";
   protected $btInterfaceHeight = "450";
   protected $btCacheBlockRecord = true;
   protected $btCacheBlockOutput = true;
   protected $btCacheBlockOutputOnPost = true;
   protected $btCacheBlockOutputForRegisteredUsers = true;
   protected $btCacheBlockOutputLifetime = 300;
   public function getSearchableContent() {



I have tried leaving the field name referenced here:
$field_name = 'field_1_wysiqyg_content'; //<-- You may need to change the field name depending on your db.xml file


as is, and as all of the above vaules:
prods_sum
Product Summary Box
product summary

but, each time I go to add the block, the wizzywig appears, but there is no table showing in it.

thanks for you help!
jordanlev replied on at Permalink Reply
jordanlev
Ugh... sorry, I have a typo in my code. The 2nd line should be this:
$field_name = 'field_1_wysiwyg_content';

(I had misspelled it "wysiqyg")
chameleon replied on at Permalink Reply
Oh, and I would say that if you just added a default html content box to the listing in the WYSIWYG editor section that it would be perfectly clear.
jordanlev replied on at Permalink Reply
jordanlev
Yeah, the more I think about this the more I like it. I actually realized that I could use this feature for a client site I'm currently building (I was going to give them a global scrapbook block that contained the defaults, but if they ever want it on more than one page they can't change them independently!)

I'm going to try to put this in before the initial release -- thanks for the suggestion.

-Jordan
chameleon replied on at Permalink Reply
Glad you like the idea!

but - sorry to be pain, I fixed the typo in the field_name, uploaded the file, deleted my site cache (just to be safe), and I still can't see the table when I go to a page and try to add my custom block.

any thoughts? I am using a custom template for my site... would that make any difference?

I double checked the db.xml file and the field name matches up
<field name="field_1_wysiwyg_content" type="X2"></field>


thanks again!
jordanlev replied on at Permalink Reply
jordanlev
I dunno... but I've since updated the addon to include this feature so you should probably just download the latest version and use that:
http://github.com/jordanlev/c5_designer_content...

Note that you will just want to overwrite the entire designer_content directory in your packages folder -- you won't need to go through an upgrade step or anything like that (it has the same version number as the last one, even though it's updated).

By the way, I used this technique for that job I'm doing and it worked AMAZINGLY well! I had to turn on the "advanced" toolbar in the TinyMCE settings, but once I did, it had various toolbar buttons for inserting and deleting rows, and the best part is it was smart enough to copy the styles from the prior row when inserting a new one (so, for example, one of the columns had pricing in it so it was aligned to the right in my "starter content" table -- when I inserted a new row below that in TinyMCE, the new row had that column aligned right automatically!).

This was so useful and clever, actually, that I included it in the documentation as one of the usage example (I submitted it to the marketplace yesterday -- no idea how long approval will take though).

Thanks.

-Jordan
chameleon replied on at Permalink Reply
BRILLIANT!!!!!!!!!!!!!!!!!!!!

This is working perfectly!!!

Thanks so much, you saved me a ton of time!