Forward facing file manager image picker - how to do in 5.5?

Permalink
I'm working on a forward facing blogging application where every registered user of the site has access to a form to add or edit blog posts, but the users don't have edit access to the page. They do have access to the file manager, but I don't know what to add as far as header items in 5.5 in order to get the file picker to actually function. In 5.4.2.2 this is what I did:

public function on_start() {
Loader::model('page_list');
      $this->error = Loader::helper('validation/error');
      $html = Loader::helper('html');
      $this->addHeaderItem($html->css('ccm.ui.css'));
      $this->addHeaderItem($html->css('jquery.rating.css'));
      $this->addHeaderItem($html->css('ccm.dialog.css'));
      $this->addHeaderItem($html->css('ccm.menus.css'));
      $this->addHeaderItem($html->css('ccm.forms.css'));
      $this->addHeaderItem($html->css('ccm.search.css'));
      $this->addHeaderItem($html->css('ccm.filemanager.css'));
      $this->addHeaderItem($html->css('ccm.colorpicker.css'));
      $this->addHeaderItem($html->css('jquery.ui.css'));
      $this->addHeaderItem($html->javascript('jquery.form.js'));
      $this->addHeaderItem($html->javascript('jquery.js'));


What is the equivalent in 5.5 to get this working? I suppose I could just copy every file that's included when I view the source of the page but that seems like overkill. Any insight as to what I need to do would be appreciated.

hereNT
 
baryongroup replied on at Permalink Reply
baryongroup
Have you got an answer to this? I would also like to know how to do that. Currently, I give registered users approval permissions on the page, but then hide the Concrete5 toolbar when they access the page, so all the JS is loaded and the toolbar is gone. I'd really like to have a more clean solution in 5.5.
hereNT replied on at Permalink Reply
hereNT
I got it working but I'm not sure exactly how. Looking at the code in the single page that this is on it looks like all I'm including is tinymce:

public function on_start() {
$this->addHeaderItem(Loader::helper('html')->javascript('tiny_mce/tiny_mce.js'));
}


I might have done more somewhere else but I don't remember what it was.
baryongroup replied on at Permalink Reply
baryongroup
I've tried that and I get JS errors on the image selectors.
hereNT replied on at Permalink Reply
hereNT
I'm doing mine with an attribute, so maybe that's the difference?

<?php
Loader::model("attribute/categories/collection");
$akt = CollectionAttributeKey::getByHandle('thumbnail');
if (is_object($blog)) {
     $tvalue = $blog->getAttributeValueObject($akt);
}
?>
<div class="blog-attributes">
     <div style="width: 230px;"> <strong>
               <?php echo $akt->render('label'); ?>
          </strong>
          <?php echo $akt->render('form', $tvalue, true); ?>
     </div>
</div>
baryongroup replied on at Permalink Reply
baryongroup
*Note, this is not my optimal solution. I'd rather do this by pulling all the correct js in via the controller, but this "works" for now.

This is a single page I'm displaying my form with image selectors/etc.

In my controller:

$this->set('al', Loader::helper('concrete/asset_library'));


In my single page view to display the image picker:

<?php   echo $al->image('site_banner', 'site_banner', 'Choose Site Banner', $sitePage->getAttribute('site_banner')); ?>


To get the modal to load/asset library to render, I'm currently giving approve access (to get all the correct JS to load in head/foot) and then hiding the C5 toolbar with this javascript:

<script>
var isBarVisible = false;
$(document).ready(function() {
    $("#ccm-page-controls-wrapper").stop(true, true).hide();
   $("#c5showhidebarr").click(function() {
      if(isBarVisible){
         $("#ccm-page-controls-wrapper").stop(true, true).hide(200);
         $("#c5showhidebarrtxt").text("Show edit bar");
      }
      else{
         $("#ccm-page-controls-wrapper").stop(true, true).show(200);
         $("#c5showhidebarrtxt").text("Hide edit bar");
      }
      isBarVisible = !isBarVisible;
   });


I've tried loading the javascript modal/etc as explained on Andrew's Jquery/C5 page (http://andrewembler.com/posts/javascript-jquery-and-concrete5/) but this doesn't appear to work for me in 5.5.
hereNT replied on at Permalink Reply
hereNT
It looks like I was overlooking another function. This might do you better:

protected function setupForm() {
      $html = Loader::helper('html');
      $this->addHeaderItem($html->javascript('tiny_mce/tiny_mce.js'));
      $this->addHeaderItem($html->javascript('jquery.js'));
      $this->addHeaderItem($html->javascript('ccm.base.js'));
      $this->addFooterItem('<script type="text/javascript" src="' . REL_DIR_FILES_TOOLS_REQUIRED . '/i18n_js"></script>'); 
      $this->addFooterItem($html->javascript('jquery.form.js'));
      $this->addFooterItem($html->javascript('ccm.app.js'));
      $this->addHeaderItem($html->css('ccm.app.css'));
      $this->addHeaderItem($html->css('jquery.ui.css'));
   }


I think that's what's loading up all the code I need for the file manager and rich text editor when not logged in as an admin.