Adding another "Add a Sub-Page" button with the same functionality as the original one
Permalink
Hi!
I'm talking about the button in the dropdown menu in the top left c5 dashboard.
In the file /concrete/tools/page_controls_menu_js.php at line 196 we have:
I copied that line and added it again just below. That made another "Add a Sub-Page" button right next to the original one. When I click it, the contents is what I expect, but it's displayed as a new page, rather than as a pop-up.
So my question is: What do I have to do in order to make it display as a pop-up?
I think I'm supposed to add some javascript somewhere, I just have no clue where.
I'm also aware that I shouldn't edit /concrete/ directly and I'm not doing that.
Thanks
I'm talking about the button in the dropdown menu in the top left c5 dashboard.
In the file /concrete/tools/page_controls_menu_js.php at line 196 we have:
menuHTML += '<a id="ccm-toolbar-add-subpage" dialog-width="645" dialog-modal="false" dialog-append-buttons="true" dialog-height="345" dialog-title="<?php echo t('Add a Sub-Page')?>" href="<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>/edit_collection_popup.php?cID=<?php echo $cID?>&ctask=add"class="btn"><?php echo t('Add a Sub-Page')?></a>';
I copied that line and added it again just below. That made another "Add a Sub-Page" button right next to the original one. When I click it, the contents is what I expect, but it's displayed as a new page, rather than as a pop-up.
So my question is: What do I have to do in order to make it display as a pop-up?
I think I'm supposed to add some javascript somewhere, I just have no clue where.
I'm also aware that I shouldn't edit /concrete/ directly and I'm not doing that.
Thanks
Hey Emir5 - your last forum post got stuck in the spam filter. I'll put you on the spam whitelist and you can post your message again in a few minutes.
You need to call the dialog function on your element, you will want to change the element ID to something unique.
<script type="text/javascript"> $(function() { $("#myDialog").dialog(); }); </script>
Thanks IconicSchmea, but that doesn't work. I changed #myDialog to the id of my element and pasted it in the same file: page_controls_menu_js.php.
What gets me even more confused is that the only calls to dialog() in the entire concrete5 dir is at /concrete/js/ccm_app/toolbar.js lines 211-218. I tried adding another line there with the id of my element but that changed nothing.
What tells C5 that the original "Add a Sub-Page" button in the dashboard should display it's href in a pop-up? Thats the million dollar question for me right now. Anyone that knows?
What gets me even more confused is that the only calls to dialog() in the entire concrete5 dir is at /concrete/js/ccm_app/toolbar.js lines 211-218. I tried adding another line there with the id of my element but that changed nothing.
What tells C5 that the original "Add a Sub-Page" button in the dashboard should display it's href in a pop-up? Thats the million dollar question for me right now. Anyone that knows?
Finally! I managed to work it out and though I should explain how I did it.
The file /concrete/js/ccm.app.js contains a long unreadable string of javascript. Search that string for the id "#ccm-toolbar-add-subpage".
Copy that statement and paste it right after the statement you copied. Replace "#ccm-toolbar-add-subpage" with the id of your own button. That's it! Now your link will open up in a pop-up.
The file /concrete/js/ccm.app.js contains a long unreadable string of javascript. Search that string for the id "#ccm-toolbar-add-subpage".
Copy that statement and paste it right after the statement you copied. Replace "#ccm-toolbar-add-subpage" with the id of your own button. That's it! Now your link will open up in a pop-up.