From f4a51541ad6e0f7b05a6fd8f377d58e8ef620840 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 2 Jul 2007 16:57:50 +0000 Subject: [PATCH] Using the new "choose" parameter to navigate/preview/choose IMS-CP resource packages. MDL-10036 Merged from MOODLE_18_STABLE --- mod/resource/type/ims/finder.php | 31 ++++++++++++++++++++----------- mod/resource/type/ims/preview.php | 27 ++++++++++++++++++--------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/mod/resource/type/ims/finder.php b/mod/resource/type/ims/finder.php index 554864a653..c7ba6fc631 100644 --- a/mod/resource/type/ims/finder.php +++ b/mod/resource/type/ims/finder.php @@ -10,6 +10,7 @@ /// Directory to browse, inside repository. Starts on ''. $directory = optional_param ('directory', '', PARAM_PATH); + $choose = optional_param('choose', 'id_reference_value', PARAM_FILE); /// Get the language strings needed $strdeployall = get_string('deployall','resource'); @@ -59,11 +60,11 @@ /// Prints the toolbar. echo '
'; - ims_print_crumbtrail($directory); + ims_print_crumbtrail($directory, $choose); /// If admin, add extra buttons - redeploy & help. if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) { - echo " | ($strdeployall) "; + echo " | ($strdeployall) "; helpbutton("deploy", get_string("deployall", "resource"), "resource", true); } echo '
'; @@ -74,11 +75,19 @@ foreach ($items as $item) { if ($item->type == 'deployed') { - echo "
  • \"IMS $item->name ($strchoose) (path\">$strpreview)
  • \n"; + ?> + + \"IMS $item->name" . + "(path')\" href=\"#\">$strchoose) " . + "(path&choose=$choose\">$strpreview)\n"; } else if ($item->type == 'not deployed') { /// Only displays non-deployed IMS CP's if admin user. @@ -87,7 +96,7 @@ } } else if ($item->type == 'directory') { - echo "
  • \"IMS path\">$item->name
  • \n"; + echo "
  • \"IMS path&choose=$choose\">$item->name
  • \n"; } } } @@ -101,7 +110,7 @@ exit; /// Generates the crumbtrial from $directory. Just splits up on '/'. - function ims_print_crumbtrail($directory) { + function ims_print_crumbtrail($directory, $choose='') { $strrepository = get_string('repository','resource'); $arr = explode('/', $directory); @@ -111,13 +120,13 @@ return; } else { - $output = "$strrepository » "; + $output = "$strrepository » "; } $itemdir = ''; foreach ($arr as $item) { if ($item == '') continue; $itemdir .= '/'.$item; - $output .= "$item » "; + $output .= "$item » "; } $output .= $last; echo $output; diff --git a/mod/resource/type/ims/preview.php b/mod/resource/type/ims/preview.php index e07610e904..5611c4c63a 100644 --- a/mod/resource/type/ims/preview.php +++ b/mod/resource/type/ims/preview.php @@ -9,6 +9,7 @@ require_once('repository_config.php'); $directory = required_param ('directory', PARAM_PATH); + $choose = optional_param ('choose', 'id_reference_value', PARAM_FILE); $page = optional_param ('page', 0, PARAM_INT); /// Calculate the path of the IMS CP to be displayed @@ -57,7 +58,9 @@ /// content - this produces everything else /// adds side navigation bar if needed. must also adjust width of iframe to accomodate - echo "
    "; preview_buttons($directory, $items['title']); echo preview_ims_generate_toc($items, $directory, 0, $page); echo "
    "; + echo "
    "; + preview_buttons($directory, $items['title'], $choose); + echo preview_ims_generate_toc($items, $directory, 0, $page); echo "
    "; $fullurl = "$CFG->repositorywebroot/$directory/".$items[$page]->href; /// prints iframe filled with $fullurl ;width:".$iframewidth." missing also height=\"420px\" @@ -138,7 +141,7 @@ return $contents; } - function preview_buttons($directory, $name) { + function preview_buttons($directory, $name, $choose='') { $strchoose = get_string('choose','resource'); $strback = get_string('back','resource'); @@ -146,13 +149,19 @@ $arr = explode('/', $directory); array_pop($arr); $directory = implode('/', $arr); - echo "
    - ($strback) - ($strchoose)
    "; + ?> + + ". + "($strback) ". + "($strchoose)"; } ?> -- 2.39.5