Block with multiple complex objects on (sort of solved)

Permalink
Edit: I've accomplished this by reversing my thinking and bringing some of the fields up into the page headers (using custom page fields) and using a custom-templates page list to do the output. It's a little more awkward to set up a new staff member but it works.

I'm writing a fairly complicated looking block. At least I'm trying to and I'm sure it's simple as hell... But I'm struggling.

It's supposed to show information about staff members (nothing to do with c5 dashboard users) in two contexts. The first is a list of staff members for a department where a thumbnail and extract are shown and the second is a special page that shows their full description with a larger image.

For simplicity, I want to do that in one block.

So there are the following fields:
- Name (varchar - text input)
- Qualifications (varchar - text input)
- Abstract (varchar - text input)
- Detail (text - TinyMCE HTML editor)
- Thumbnail (image - the new image selector)
- Image (image - the new image selector)

All fairly okay but I'm having some issues putting a rich editor on the same page as one of the image selectors. Whenever you select an image, it stuffs the image INTO the Detail content (obviously not what I want).

I'm hacking around using existing block code, so I might be being a moron... but it could be a limitation.

Somebody let me know if they've put those two controls onto the same block before. I'll be posting back with code once I've made sure I'm not being an idiot.

oliwarner
 
oliwarner replied on at Permalink Reply
oliwarner
Here's the add.php

<?php 
defined('C5_EXECUTE') or die(_("Access Denied."));
$replaceOnUnload = 1;
$includeAssetLibrary = true;
$assetLibraryPassThru = array('type' => 'image');
$al = Loader::helper('concrete/asset_library');
$bt->inc('editor_init.php');
?>
<div style="text-align: center"><input type="text" id="ccm-content-<?php echo $a->getAreaID()?>" name="body" /></div>
<div style="text-align: center"><input type="text" id="ccm-content-<?php echo $a->getAreaID()?>" name="suffixes" /></div>
<div style="text-align: center"><input type="text" id="ccm-content-<?php echo $a->getAreaID()?>" name="extract" /></div>
<div style="text-align: center"><textarea id="ccm-content-<?php echo $a->getAreaID()?>" class="advancedEditor" name="body"></textarea></div>
<div class="ccm-block-field-group">
   <h2><?php echo t('Thumbnail image')?></h2>
   <?php echo $al->image('ccm-b-image-thumb', 'thumbnail', t('Choose Image'), $bf1);?>


The $bf# variables are null (as they are in the image-block's add.php).
oliwarner replied on at Permalink Reply
oliwarner
I need to get this working by yesterday. Any ideas?
maar replied on at Permalink Reply
maar
Did you ever find a solution for this?
jbx replied on at Permalink Reply
jbx
I also have this problem and have posted in the main forum and the service partner forum, but have yet to get a response. Surely this is possible... Can any of the Concrete5 Guru's help out on this one? It doesn't seem like a particularly odd request to want both an image and a content box within the same block. Must be a way to get it to work...
maar replied on at Permalink Reply
maar
http://www.concrete5.org/community/forums/customizing_c5/need_a_block_and_for_you_people_-_should_be_a_easy_one/#17461

Hope that will help you!
jbx replied on at Permalink Reply
jbx
I took a look at what you have done there, but the way you have got the image selector to work is by disabling the custom toolbar for tiny_mce, so you can no longer add links or images or files into the content box. Unfortunately I need both working, so that wont work for me. Thanks for posting tho.
ryan replied on at Permalink Reply
ryan
I haven't tested this code at all, but you'll get the idea. Basically you store the element that you're going to add the file manager object to in a class variable when you click the link to open the file manager and then depending on what that's set to you can decide where to return the file manger element. You'll have to do some copy/pasting of the existing editor_init code into your block's auto.js file.
<script language="javascript">
var MyBlocksClass = {
   addImageTo:null,
   chooseImg:function(elem){ 
      this.addImageTo = elem; // jqyery element to add the image to, stored when this function is called
      ccm_launchFileManager('&fType=' + ccmi18n_filemanager.FTYPE_IMAGE);
   },
   chooseAssetHandler:function(obj) {
      if(this.addImageTo.length) {
         this.insertOtherField(obj);
      } else {
         this.insertIntoEditor(obj);
      }
   }
   insertOtherField:function(obj) {