Open a dialog inside Add/Edit.php

Permalink
I'm creating a block that needs to open a dialog box inside the Add or Edit.php files. I've followed what has been done in the slideshow block but I'm getting "access denied" when the dialog opens. Here's my code

in the form_setup_html.php
defined('C5_EXECUTE') or die(_("Access Denied."));
$al = Loader::helper('concrete/asset_library');
$ah = Loader::helper('concrete/interface');
....
echo $ah->button_js(t('Crop Image'), 'sampleBlock.cropImg()');

then in auto.js
var sampleBlock = {
        init:function(){},   
   cropImg:function(){ 
      jQuery.fn.dialog.open({ 
         width: 750,
         height: 450,
         modal: false,
         href: "blocks/sampleBlock/crop.php",
         title: 'Choose Images to Add'
      });
   },
}

then in crop.php
defined('C5_EXECUTE') or die(_("Access Denied."));
$c = Page::getByPath("/dashboard/mediabrowser");
$cp = new Permissions($c);
$valt = Loader::helper('validation/token');
.....

It opens the dialog but is displaying "Access Denied". If I delete the C5_EXECUTE line it fails on the concrete functions. Deleting the concrete functions it loads the page but I loose my connection to the information stored in concrete.

Is there soemthing I'm missing?

TravisN
 
Remo replied on at Permalink Reply
Remo
if you do, it doesn't include the c5 stuff and you won't be able to access the c5 api. Which is also the reason why the constants aren't available..

check this out:http://www.concrete5.org/index.php?cID=5056...
TravisN replied on at Permalink Reply
TravisN
Got it. Thanks for the help.
Remo replied on at Permalink Reply
Remo
glad it worked!

It might be nice to have an official article about that problem because a lot of people had it and a lot are going to have it..

I still wonder where and how we could manage that kind of information. There are already a few snippets on that site, but maybe a wiki would help too?..
TravisN replied on at Permalink Reply
TravisN
Concrete5 is a fantastic program, but with all the info in these forums and incomplete documentation, it's getting very hard to find the info relevant to the questions at hand. Just look at all the queries about uploads failing!!! If it was easy to find people wouldn't be asking the same question over and over.

That said the scattered info, having to delve into the core to find answers and difficulty in finding the right answer without pestering the forums for what might be trival questions, slows down and will only continue to slow down third party development.

I know the difficulty on finding info has been brought up before and Andrew and Frz disagree, but I think your right, a wiki could possibly be the answer.

Again fantastic software but I agree that something needs to be done about being able to source the right info.
frz replied on at Permalink Reply
frz
Look, Andy and I certainly don't disagree that it's annoying to be answering the same question over and over again.
We don't disagree that there's a lot going on under the hood and concrete5 would benefit from more documentation.

We are in complete agreement about that where I think our prospective might change from some of the feedback is we've heard, is that we believe it is a lack of content, not the organization of it that is the problem.

To be perfectly blunt, many of the questions people ask ARE covered in the docs already - they just haven't looked. Moreover, the complaints of "its hard to find what I'M looking for" are rarely, if ever, connected to "and here's what would really help."

A wiki is not a solution to that problem. All that does is give us yet another thing to have to manage and cleanup. If we do that, (and we actually started with one, so we're not speaking out of turn here) the next thing is we'll hear "there's too much meaningless documentation and its half out of date, i can't find anything??"

I'm not trying to come off as confrontational about this, but it just strikes me that almost EVERY open source project has issues with not enough documentation and the learning curve. Given infinite money and time, I'd have a lot more screencasts and tutorials, I'd have a book you could buy and put on your desk. I have neither infinite money or time however - so both of those are going to have to happen as they can.

At some point the question quickly becomes, what do you want us to be doing? 5.3 & with the file manager? The eCommerce everyone wants? The forums everyone wants? The docs everyone wants? Did I mention Obama has yet to send us a grant to ensure that content management really does become a human right? (grins)

What you, and all your concerned breatheren could really do to HELP is actually write some docs up. We recently had t00thless submit a windows install guide. It immediately went to the beta team, 2 people have tested it and said its right, we're gonna post it to the docs asap. See? We actually do stuff when there's stuff to do.

Crap, we even made a site manager group and put some active folk in it with the idea that they might want to help update parts of the site. We do have this cool CMS we can use ya know... its not the technology that's missing...

its the <ahem> contributions.
TravisN replied on at Permalink Reply
TravisN
Frz, I intended no offense with my response to Remo. I said a wiki COULD be the answer only due to my experiences withhttp://openbase.wikidot.com/

I am more than happy to provide assistance where I can, and I have done so for a few of the people experiencing the "upload" problems. But I am still learning the concrete5 system from the developers standpoint, and can only provide limited help in this area.

After your comment of "covered in the docs" I went over your help section again, as I always do before resorting to the forums, and my only comment there is the "Latest Updates" is not kept up to date. This would be handy, as knowing which docs have been amended or added could stop a lot of heartache. Take for instance tOOothless's guide. How would we even know it was added without frequenting all the sections of you website? And if it's mentioned in the forums, well the new post has dissappeared from the "recent" list within 10 fresh posts.

One way searching for info in the forums could possibly be improved is to add page tags. You could give permission to certain people to add specific tags to relevant threads. That way searches can be performed on just the tags and you get the information relevant to what you need. If the thread doesn't contain the exact phrase/words your searching for, there it is because it has the tag. If the thread is just a general discussion with no problem solving information, it doesn't appear.

Please understand that no-one is saying you are not doing anything, we know it's open source, the help you provide is free and you like everyone is limited in their resources. I will continue to help where I can. And as I said NO OFFENSE INTENDED.
frz replied on at Permalink Reply
frz
no offense taken, i didn't mean to sound testie.

I like the idea of tags.. It's interesting that you mention latest updates - that's actually about the version releases of concrete5, not the docs section. it would probably make sense to have that as well.

I've been talking with the team about adding a "Question" block that would just be a Q/A you could add anywhere, and then a "FAQ" block that would summarize them elsewhere... that might be an architectural help as well.

I guess my point is, if anyones got the time and energy, I'm more than happy to give you editor writes in the help section.
TravisN replied on at Permalink Reply
TravisN
I'm happy to help. Although I'm currently working on what should be a fully customizable image gallery. Perhaps you could provide a little assistance re a problem I'm having. I'll post it on a new thread with details.