embedding flash and maintaining C5 connection

Permalink
I have a dialog called from the add/edit.php. It loads correctly with an indirect call to the php file. This php file contains a swf file that must call another php to do some work for the flash file. All through the path it needs to maintain it's link to the C5 systems.

I can get it to load the flash if I call it directly, but as soon as I try to call it indirectly it wont load. Communication between flash and php is working, it just gets "access denied because" I am not calling flash indirectly.

I've tried using embed and swfobject. Both don't load the swf when called indirectly.

To summarise the path is
add/edit.php opens -dialog->dialog.php contains swf->save.php

does anyone know what I could be missing i am using
[code]$ci->getBlockTypeToolsURL($bt)[code]
to get the indirect path.

TravisN
 
frz replied on at Permalink Reply
frz
its been a long while since I've dealt with this type of thing personally... but..

by indirectly and directly do you mean relative and absolute paths? Or are you talking about some other new hibble-habble that's flash specific and I don't know about?

If its the relative/absolute problem that wouldn't shock me. Since your php files are in various sub directories, that doesn't shock me. since you're talking about a block and you know where it's going to live, can you just use an absolute path from root to get at it? '/blocks/yadda/add/some.swf' or something along those lines..?

The other thing you could do is open the activity monitor in safari and see where its trying to hit for this swf, then adjust accordingly.

But again, i feel like i could be answering the wrong question here.
TravisN replied on at Permalink Reply
TravisN
Hibble-Habble coined directly and indirectly from Remo's answer when I lost the C5 connection between the dialog and the dialogs content php.
http://www.concrete5.org/community/forums/customizing_c5/open_a_dia...

directly: blocks/SampleGallery/tools/crop.swf

indirectly
/concrete/index.php/tools/blocks/SampleGallery/crop.swf

indirectly is what I use in the auto.js to open the dialog with href: /concrete/index.php/tools/blocks/SampleGallery/dialog.php

Also referred here in the docs (although not as "directly/indirectly"). paragraph 6
http://www.concrete5.org/help/building_with_concrete5/developers/mv...
ScottC replied on at Permalink Reply
ScottC
I am not quite sure I understand, I would think that any reference to blocktype tools url should always be tools under the installed block type's directory.

siteroot/tools/ is something that would be block agnostic and installed as part of a package where multiple block controllers or pagetypes or overrides of standard concrete/tools php files would reside.

I might have more to offer monday.
TravisN replied on at Permalink Reply
TravisN
getBlockTypeToolsURL returns
/concrete/index.php/tools/blocks/SampleGallery

My first thoughts were what your saying but when I place my dialog php in

concrete/tools/blocks/SampleGallery

it wouldn't find it. I eventually nutted it down that mod_rewrite was converting the path to

concrete/blocks/SampleGallery/tools
ScottC replied on at Permalink Reply
ScottC
hardcoded directory name in the controller bc i knew the directory name since i uploaded it:

public function kgetBlockPath()
      {
      //gangster weak code below that works
      $blockPath = BASE_URL . '/' . DIRNAME_BLOCKS . '/' . $this->directoryName() . '/tools/';   
      return $blockPath;
      }
TravisN replied on at Permalink Reply
TravisN
Hi Scott. I tried all you options suggestedhttp://www... your little function, getBlockTypePath, typing the path in directly. Unfortunately none work, all would just leave a blank stage. But..

Here's what I think needs to be done. I decompiled the uploader.swf C5 uses, and looked over the calling php file. The calling php file is calling the SWF file "directly", but it's passing the session_id to flash. Before flash passes the upload() it calls this line
__reg2.postData = "ccm-session=" + this.CCM_SESSION;

My flash uses ActionScript 3, so could this be the answer. do I need to find the AS3 method to perform the same routine, before I call upload()?

Does anybody have any thoughts?
Remo replied on at Permalink Reply
Remo
I think this is a commen flash problem.

the last flash file I've included was swfupload. An example:http://demo.swfupload.org/v220beta5/multiinstancedemo/index.php... Check the code and you'll see that they pass the session id to the flash file and the flash file passes it back to the php that uploads the file...

Sorry about inventing the words "direct/indirect" but I couldn't find a better single word for it :) But I like hibble habble
TravisN replied on at Permalink Reply
TravisN
I think your description of direct/indirect was a good one. It's quite accurate. And it put me on the right path to get my block working. Session was one the issues as you can see below, but now I can alter the pics I need and save them to the Asset Library. If you like jquery and need a simple but powerful upload plugin I've been working on one with Ronnie Garcia called UPLOADIFY. You can get it at
http://www.ronniesan.com/articles/jquery-multiple-file-upload.php...
We're currently working on a new website. And you'll see it in my soon to be released Image Gallery block.
Remo replied on at Permalink Reply
Remo
thanks!

I'm a lot into jQuery and that upload plugin definitely looks fine! swfupload works for me too and since it does pretty much the same thing, there's no need for me to replace it but it's nicely done. Simple and clean and a nice documentation.

Are you working on a "multi-file-add-capable" gallery block? I built one as well (is somewhere hidden in these forums) but never finished it. I basicalley used the c5 flash uploader (which will be replaced) to upload files into a different directory. Files didn't appear in the file manager. Which in somecases is nice and in others isn't.

If you need a tester for that gallery block, feel free to send me a pre-release of it!
TravisN replied on at Permalink Reply
TravisN
I have solved my C5 lost connection problem. The save.php simply calls C5's al_upload_xx.php. There were three things I needed to do to maintain the connection.

1. from flash send the path relative to where the tool resides ie
REL_DIR_FILES_TOOLS_REQUIRED'./al_upload_process_multiple.php'
this returns
/concrete/index.php/tools/required/al_upload_process_multiple.php
mod_rewrite converts this to
concrete/concrete/tools/al_upload_process_multiple.php

It is important to call the script from flash in this fashion, or it's all stop. 'Access Denied'.
2. you need to send the session_id against the parameter 'ccm-session' or you don't pass the define('C5_EXECUTE')
3. lastly you need to include the collection id against the parameter cID. or the permission check will fail.

Action Script 2 or ActionScript 3 it makes no difference.

In summary in AS3 the call is
file.upload('REL_DIR_FILES_TOOLS_REQUIRED'+'/al_upload_process_multiple.php?ccm-session=session_id()&cID=$c->getCollectionID());
I've combined C5 definitions, AS3 method and php. If you use it you'll need to separate it out and pass the values correctly.
ScottC replied on at Permalink Reply
ScottC
I have found that it is almost best to trust your naming conventions and build some paths for yourself. If you look at what getBlockTypePath or GetBlockTypeToolURL really does, you could replicate that yourself in the way that you have specified your layout with your block/path aggregation. These are helper methods, IE they will help you to not repeat yourself, but if you can not reliably get the path in your code, suck it up and do it yourself. No one will think the less of you :)

That being said that wasn't entirely on topic and if like the frz mentioned below you could specify "indirectly" being a php include or just a relative file include based on server paths that could be helpful. I prefer jibba jabba to hibble habble but that is neither here nor there =)
frz replied on at Permalink Reply
frz
there's too much jibber jabber - its time for hibble habble.
bcarone replied on at Permalink Reply
bcarone
I have to remember that term...

Hibble Habble

Chucklin down the matrix I go (shakes head and burns one)
bcarone replied on at Permalink Reply
bcarone
I have to remember that term...

Hibble Habble

Chucklin down the matrix I go (shakes head and burns one)