diff --git a/Resources/Private/Partials/SelectRoot.html b/Resources/Private/Partials/SelectRoot.html index 6ee2968b847ac0c85c30ee4a4d3fc10d1e9db253..d49dd6cd13c92c57d312be1d249094b31dca727e 100644 --- a/Resources/Private/Partials/SelectRoot.html +++ b/Resources/Private/Partials/SelectRoot.html @@ -10,7 +10,7 @@ <f:for each="{pages}" as="page"> <tr data-uid="{page.uid}"> <td nowrap="nowrap" class="col-title"> - <a href="#" onclick="sgRouteGoToPage({page.uid}, '{page.path}'); return false;"> + <a href="#" onclick="sgJobsGoToPage({page.uid}, '{page.path}'); return false;"> <f:format.raw> <sg:backend.icon table="pages" row="{page}" clickMenu="0" /> {page._thePathFull} </f:format.raw> diff --git a/Resources/Private/Templates/Backend/Index.html b/Resources/Private/Templates/Backend/Index.html index 069938476ca2357df2093e34cee42da9de67f380..aae8e10ce90f11d1b0f9bb75d69d491343ef3ff0 100644 --- a/Resources/Private/Templates/Backend/Index.html +++ b/Resources/Private/Templates/Backend/Index.html @@ -1,3 +1,5 @@ +{namespace sg=SGalinski\SgJobs\ViewHelpers} + <f:layout name="Default" /> <f:section name="iconButtons"> @@ -9,7 +11,7 @@ <f:debug>{_all}</f:debug> <f:if condition="{rootPageUid}"> <f:then> - <h1>test</h1> + <h1>{rootPageUid}</h1> </f:then> <f:else> diff --git a/Resources/Public/Scripts/Backend.js b/Resources/Public/Scripts/Backend.js index 977424a17caaa42e190d6053646b7b6071f2f16d..2b75e50919846feda2b37057f9d850abd64d645e 100644 --- a/Resources/Public/Scripts/Backend.js +++ b/Resources/Public/Scripts/Backend.js @@ -1,3 +1,19 @@ +(function($) { + function deleteAllListener(_event) { + _event.preventDefault(); + + var confirm = SG.lang.SgRoutes['backend.delete_all']; + if (window.confirm(confirm)) { + window.location = $(_event.currentTarget).attr('href'); + } + } + + $(document).ready(function() { + $('.btn-delete-all').on('click', deleteAllListener); + $.get(TYPO3.settings.ajaxUrls['sg_routes::ajaxPing']); + }); +})(TYPO3.jQuery); + // functions for backend docheader functionality function jumpExt(URL, anchor) { // var anc = anchor ? anchor : ""; @@ -21,4 +37,54 @@ function setHighlight(id) { // if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); } -} \ No newline at end of file +} + +/** + * Switches to the spefied page in the BE + * + * @param {number} uid + * @param {string} path + */ +function sgJobsGoToPage(uid, path) { + if (top.nav) { + top.nav.invokePageId(uid,gotToPageCallback); + } else { + var tree = top.Ext.getCmp('typo3-pagetree'); + if (tree) { + tree.activeTree.selectPath(path); + } + var separator = '?'; + if (top.currentSubScript.indexOf('?') !== -1) { + separator = '&'; + } + top.TYPO3.Backend.ContentContainer.setUrl( + top.currentSubScript + separator + 'id=' + uid + ); + } +} + + +/** + * Callback for page selection in the pagetree + */ +function gotToPageCallback(path){ + var callback = top.Ext.createDelegate(top.nav.mainTree.selectPath, top.nav.mainTree); + callback.apply(this, arguments); + var node = top.nav.getSelected(); + if (node) { + top.TYPO3.Components.PageTree.Actions.singleClick(node, top.TYPO3.Components.PageTree.Tree); + } +} + +/** + * opens the selected category edit form + * + * @return {boolean} + */ +function editSelectedCategory(){ + var selected = TYPO3.jQuery('#filter-categories').val(); + if(selected && CategoryEditLinks[selected[0]]) { + jumpToUrl(CategoryEditLinks[selected[0]] + '&returnUrl=' + T3_THIS_LOCATION); + } + return false; +}