Can anyone point me in the direction of modifying the Page selector
I would like it to list pages only below a certain page, and when you click select page it loads up by default on the search tab so that they can be displayed in alphabetical order.
This is to say I have a gallery that has 100+ pages, each album can have a client assigned(page), so when I click Select Page I would like it to only show the pages starting at my gallery page (in this instance node=69)
I can load the initial node to be the starting page but every time I click either "full" or "one level" it defaults to being 0/1 I assume this is the ccm.sitemap.js (within the function ccm_sitemapSelectDisplayMode())
I would like the results to be sortable, and having it load by default on the search tab makes a bit more sense to me, as this could then be sorted and filtered.
<?php
/**
* @package Helpers
* @category Concrete
* @subpackage Forms
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/... MIT License
*/
/**
* Special form elements for choosing a page from the concrete5 sitemap tool.
* @package Helpers
* @category Concrete
* @subpackage Forms
* @author Andrew Embler <andrew@concrete5.org>
<?php
/**
* @package Helpers
* @category Concrete
* @subpackage Forms
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/... MIT License
*/
/**
* Special form elements for choosing a page from the concrete5 sitemap tool.
* @package Helpers
* @category Concrete
* @subpackage Forms
* @author Andrew Embler <andrew@concrete5.org>
* @copyright Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
* @license http://www.concrete5.org/license/... MIT License
*/
defined('C5_EXECUTE') or die(_("Access Denied."));
class FormCustomClientSelectorHelper {
/**
* Creates form fields and JavaScript page chooser for choosing a page. For use with inclusion in blocks.
* <code>
* $dh->selectPage('pageID', '1'); // prints out the home page and makes it selectable.
* </code>
* @param int $cID
*/
public function selectPage($fieldName, $cID = false, $javascriptFunc='ccm_selectSitemapNode') {
$selectedCID = 0;
if (isset($_REQUEST[$fieldName])) {
$selectedCID = $_REQUEST[$fieldName];
} else if ($cID > 0) {
$selectedCID = $cID;
}
$display_mode = "galleries";
$html = '';
$html .= '<div class="ccm-summary-selected-item"><div class="ccm-summary-selected-item-inner"><strong class="ccm-summary-selected-item-label">';
if ($selectedCID > 0) {
$oc = Page::getByID($selectedCID);
$html .= $oc->getCollectionName();
}
$html .= '</strong></div>';
$html .= '<a class="ccm-sitemap-select-page" dialog-sender="' . $fieldName . '" dialog-width="90%" dialog-height="70%" dialog-modal="false" dialog-title="' . t('Choose Client Page') . '" href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/sitemap_search_selector.php?display_mode=galleries&sitemap_select_mode=&cID=' . $selectedCID . '">' . t('Select Client Page') . '</a>'; $html .= '<input type="hidden" name="' . $fieldName . '" value="' . $selectedCID . '">';
$html .= '<input type="hidden" name="display_mode" value="galleries">';
$html .= '</div>';
$html .= '<script type="text/javascript">
var ccmActivePageField;
$(function() {
$("a.ccm-sitemap-select-page").unbind();
$("a.ccm-sitemap-select-page").dialog();
$("a.ccm-sitemap-select-page").click(function() {
ccmActivePageField = this;
});
});
ccm_selectSitemapNode = function(cID, cName) { ';
if($javascriptFunc=='' || $javascriptFunc=='ccm_selectSitemapNode'){
$html .= '
var fieldName = $(ccmActivePageField).attr("dialog-sender");
var par = $(ccmActivePageField).parent().find(\'.ccm-summary-selected-item-label\');
var pari = $(ccmActivePageField).parent().find("[name=\'"+fieldName+"\']");
par.html(cName);
pari.val(cID);
';
}else{
$html .= $javascriptFunc."(cID, cName); \n";
}
$html .= "} \r\n </script>";
return $html;
}
}
My custom sitemap
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
Loader::helper('concrete/dashboard/sitemap');
$cID = 1;
if (isset($reveal)) {
$nc = Page::getByID($reveal);
$cID = $nc->getCollectionID();
$node = $nc->getCollectionParentID();
if ($node < 1) {
$node = 1;
}
}
//$cID = 1;
if (isset($selectedPageID)) {
$cID = $selectedPageID;
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
Loader::helper('concrete/dashboard/sitemap');
$cID = 1;
if (isset($reveal)) {
$nc = Page::getByID($reveal);
$cID = $nc->getCollectionID();
$node = $nc->getCollectionParentID();
if ($node < 1) {
$node = 1;
}
}
//$cID = 1;
if (isset($selectedPageID)) {
$cID = $selectedPageID;
}
?>
<div class="ccm-pane-controls">
<?php if (!$sitemapCombinedMode) { ?>
<?php echo Loader::helper('html')->css('ccm.sitemap.css')?>
<?php echo Loader::helper('html')->javascript('ccm.sitemap.js')?>
<?php } ?>
<script type="text/javascript">
var CCM_BACK_TITLE = "<?php echo $previous_title?>";
var CCM_NODE_ACTION = "<?php echo $node_action?>";
var CCM_DIALOG_TITLE = "<?php echo $dialog_title?>";
var CCM_DIALOG_HEIGHT = "<?php echo $dialog_height?>";
var CCM_DIALOG_WIDTH = "<?php echo $dialog_width?>";
var CCM_TARGET_ID = "<?php echo $target_id?>";
var CCM_SITEMAP_EXPLORE_NODE = "<?php echo $node?>";
</script>
<?php /*echo "PT IS ".$previous_title?><br>
<?php echo "NOD_ACT IS ".$node_action?><br>
<?php echo "DIA_TIT IS ".$dialog_title?><br>
<?php echo "DIA_HEI ".$dialog_height?><br>
<?php echo "DIA_WID IS ".$dialog_width?><br>
<?php echo "TRGT IS ".$target_id?><br>
<?php echo "NODE IS ".$node?><br>
<?php echo "DISPLAY MODE IS $display_mode";*/?>
<?php if (!$sitemapCombinedMode) { ?>
<h1 id="ccm-sitemap-title"><?php echo t('Sitemap')?></h1>
<?php } ?>
<div id="ccm-dashboard-select-display-mode">
<form>
<?php
if($_REQUEST['display_mode']){
$display_mode = mysql_real_escape_string($_REQUEST['display_mode']);
}else{
$u = new User();
$sitemapOverlayPreference = $u->config('SITEMAP_OVERLAY_DISPLAY_MODE');
$display_mode = $sitemapOverlayPreference;
}
if (!isset($callback)) {
$sitemap_select_callback = 'ccm_selectSitemapNode';
}
if ($display_mode == 'galleries') {
$display_mode = 'full';
$sitemapOverlayPreference = 'full';
$node = 69;
} else if ($sitemapOverlayPreference != 'explore') {
$sitemapOverlayPreference = 'full';
$display_mode = 'full';
$node = 0;
} else if (!isset($node)) {
$node = 0;
}
//$node = 69;
?>
<input type="radio" name="ccm-dashboard-display-mode" value="full" <?php if ($sitemapOverlayPreference == 'full') { ?> checked <?php } ?> onclick="ccm_sitemapSelectDisplayMode('<?php echo $instance_id?>', 'full', '<?php echo $select_mode?>', '<?php echo $cID?>')" /> <?php echo t('Full Sitemap')?>
<input type="radio" name="ccm-dashboard-display-mode" value="explore" <?php if ($sitemapOverlayPreference == 'explore') { ?> checked <?php } ?> onclick="ccm_sitemapSelectDisplayMode('<?php echo $instance_id?>', 'explore', '<?php echo $select_mode?>', '<?php echo $cID?>')" /> <?php echo t('One Level Only')?>
</form>
</div>
<div id="tree" sitemap-wrapper="1" sitemap-select-callback="<?php echo $callback?>" sitemap-instance-id="<?php echo $instance_id?>" <?php if ($display_mode == 'explore') { ?>class="ccm-sitemap-explore"<?php } ?>>
<ul id="tree-root0" tree-root-node-id="0" sitemap-select-callback="<?php echo $sitemap_select_callback?>" sitemap-display-mode="<?php echo $display_mode?>" sitemap-select-mode="<?php echo $select_mode?>" sitemap-instance-id="<?php echo $instance_id?>">
</ul>
</div>
<script type="text/javascript">
var CCM_LAUNCHER_SITEMAP = 'galleries';
$(function() {
ccmSitemapLoad('<?php echo $instance_id?>', '<?php echo $display_mode?>', '<?php echo $select_mode?>', '<?php echo $node?>', '<?php echo $cID?>');
});
</script>
</div>
Any help on this matter would really be gratefully accepted. Im sort of in a bit of a rut with it as my JavaScript knowledge is not to good.
Thanks
Sean