diff --git a/mod/resource/type/repository/hive/hp-footer-hive-powered.gif b/mod/resource/type/repository/hive/hp-footer-hive-powered.gif new file mode 100644 index 00000000000..8f324524ffb Binary files /dev/null and b/mod/resource/type/repository/hive/hp-footer-hive-powered.gif differ diff --git a/mod/resource/type/repository/hive/makelink.php b/mod/resource/type/repository/hive/makelink.php index 0dbc1a136a5..b4ad1bb3f18 100644 --- a/mod/resource/type/repository/hive/makelink.php +++ b/mod/resource/type/repository/hive/makelink.php @@ -12,14 +12,28 @@ $part = explode('=', $part); $$part[0] = $part[1]; } + /// Generate the HIVE_REF parameter + $hive_ref = 'HIVE_REF=hii%3A'. $aliasid; + if ($latest != 'Y') { + $hive_ref = 'HIVE_REF=hdi%3A'. $itemid; + } + /// Generate the HIVE_RET parameter + $hive_ret = 'HIVE_RET=ORG'; + if ($format != 'orig') { + $hive_ret = 'HIVE_RET=CNV'; + } + $resource = $hive_ref.'&'. $hive_ret .'&HIVE_REQ=2113'; + - $resource = 'HIVE_REF=hii%3A'. $aliasid .'&HIVE_RET=ORG&HIVE_REQ=2001'; ?> + diff --git a/mod/resource/type/repository/hive/openhive.php b/mod/resource/type/repository/hive/openhive.php index d23dfeaaa81..356852cf44b 100644 --- a/mod/resource/type/repository/hive/openhive.php +++ b/mod/resource/type/repository/hive/openhive.php @@ -2,16 +2,44 @@ require_once("../../../../../config.php"); - print_header(); - - if (empty($CFG->hivehost) or empty($CFG->hivehost) or empty($CFG->hivehost) or empty($CFG->hivehost)) { + if (empty($CFG->hivehost) or empty($CFG->hiveport) or empty($CFG->hiveprotocol) or empty($CFG->hivepath)) { + print_header(); notify('A Hive repository is not yet configured in Moodle. Please see Resource settings.'); + print_footer(); die; } + if (empty($SESSION->HIVE_SESSION)) { + print_header(); + notify('You do not have access to the Hive repository. Moodle signs you into Hive when you log in. This process may have failed.'); + close_window_button(); + print_footer(); + die; + } + +$query .= '&HISTORY='; +$query .= '&hiveLanguage=en_AU'; +$query .= '&PUBCATEGORY_LIST='; +$query .= '&CATEGORY_LIST='; +$query .= '&HIDE_LOGOUT=Y'; +$query .= '&mkurl='.$CFG->wwwroot.'/mod/resource/type/repository/hive/makelink.php'; +$query .= '&HIDE_CHANGEUSERDETAILS=Y'; +$query .= '&HIVE_RET=ORG'; +$query .= '&HIVE_PAGE=Lite%20Browse'; +$query .= '&HIVE_REQ=2113'; +$query .= '&HIVE_ERRCODE=0'; +$query .= '&mklms=Doodle'; +$query .= '&HIVE_PROD=0'; +$query .= '&HIVE_REF=hin:hive@Hive%20Login%20HTML%20Template'; +$query .= '&HIVE_LITEMODE=liteBrowse'; +$query .= '&HIVE_SEREF='.$CFG->wwwroot.'/sso/hive/expired.php'; +$query .= '&HIVE_SESSION='.$SESSION->HIVE_SESSION; + + redirect($CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath .'?'.$query); +/***********8 notify('Opening HarvestRoad Hive. Please wait. Contacting '. $CFG->hivehost ); - echo '
'; + echo ''; echo ''; echo ''; @@ -33,7 +61,8 @@ echo '
'; echo ''; + print_footer(); +*************/ ?> diff --git a/mod/resource/type/repository/hive/openlitebrowse.php b/mod/resource/type/repository/hive/openlitebrowse.php new file mode 100644 index 00000000000..2a83215bd15 --- /dev/null +++ b/mod/resource/type/repository/hive/openlitebrowse.php @@ -0,0 +1,69 @@ +hivehost) or empty($CFG->hiveport) or empty($CFG->hiveprotocol) or empty($CFG->hivepath)) { + print_header(); + notify('A Hive repository is not yet configured in Moodle. Please see Resource settings.'); + print_footer(); + die; + } + + if (empty($SESSION->HIVE_SESSION)) { + print_header(); + notify('You do not have access to the Hive repository. Moodle signs you into Hive when you log in. This process may have failed.'); + close_window_button(); + print_footer(); + die; + } + +// MW Redirect to the Hive page. No need for a self-posting form as there is no sensitive data. +$query .= '&HISTORY='; +$query .= '&hiveLanguage=en_AU'; +$query .= '&PUBCATEGORY_LIST='; +$query .= '&CATEGORY_LIST='; +$query .= '&HIDE_LOGOUT=Y'; +$query .= '&mkurl='.$CFG->wwwroot.'/mod/resource/type/repository/hive/makelink.php'; +$query .= '&HIDE_CHANGEUSERDETAILS=Y'; +$query .= '&HIVE_RET=ORG'; +$query .= '&HIVE_REQ=2113'; +$query .= '&HIVE_ERRCODE=0'; +$query .= '&mklms=Moodle'; +$query .= '&HIVE_PROD=0'; +$query .= '&HIVE_REF=hin:hive@Hive%20Login%20HTML%20Template'; +$query .= '&HIVE_LITEMODE=liteBrowse'; +$query .= '&HIVE_SEREF='.$CFG->wwwroot.'/sso/hive/expired.php'; +$query .= '&HIVE_SESSION='.$SESSION->HIVE_SESSION; + + redirect($CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath .'?'.$query); +/*********** +// MW The original form + notify('Opening HarvestRoad Hive. Please wait. Contacting '. $CFG->hivehost ); + + echo '
'; + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'; + echo ''; + + print_footer(); +*************/ +?> diff --git a/mod/resource/type/repository/hive/openlitesearch.php b/mod/resource/type/repository/hive/openlitesearch.php new file mode 100644 index 00000000000..6e1d993ff79 --- /dev/null +++ b/mod/resource/type/repository/hive/openlitesearch.php @@ -0,0 +1,69 @@ +hivehost) or empty($CFG->hiveport) or empty($CFG->hiveprotocol) or empty($CFG->hivepath)) { + print_header(); + notify('A Hive repository is not yet configured in Moodle. Please see Resource settings.'); + print_footer(); + die; + } + + if (empty($SESSION->HIVE_SESSION)) { + print_header(); + notify('You do not have access to the Hive repository. Moodle signs you into Hive when you log in. This process may have failed.'); + close_window_button(); + print_footer(); + die; + } + +// MW Redirect to the Hive page. No need for a self-posting form as there is no sensitive data. +$query .= '&HISTORY='; +$query .= '&hiveLanguage=en_AU'; +$query .= '&PUBCATEGORY_LIST='; +$query .= '&CATEGORY_LIST='; +$query .= '&HIDE_LOGOUT=Y'; +$query .= '&mkurl='.$CFG->wwwroot.'/mod/resource/type/repository/hive/makelink.php'; +$query .= '&HIDE_CHANGEUSERDETAILS=Y'; +$query .= '&HIVE_RET=ORG'; +$query .= '&HIVE_REQ=2113'; +$query .= '&HIVE_ERRCODE=0'; +$query .= '&mklms=Moodle'; +$query .= '&HIVE_PROD=0'; +$query .= '&HIVE_REF=hin:hive@Hive%20Login%20HTML%20Template'; +$query .= '&HIVE_LITEMODE=liteSearch'; +$query .= '&HIVE_SEREF='.$CFG->wwwroot.'/sso/hive/expired.php'; +$query .= '&HIVE_SESSION='.$SESSION->HIVE_SESSION; + + redirect($CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath .'?'.$query); +/*********** +// MW The original form + notify('Opening HarvestRoad Hive. Please wait. Contacting '. $CFG->hivehost ); + + echo '
'; + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'; + echo ''; + + print_footer(); +*************/ +?> diff --git a/mod/resource/type/repository/repository.html b/mod/resource/type/repository/repository.html index f4a01d1b15d..a90a9e5ad3d 100644 --- a/mod/resource/type/repository/repository.html +++ b/mod/resource/type/repository/repository.html @@ -36,7 +36,28 @@ reference\" alt=\"reference\" />
"; - button_to_popup_window ('/mod/resource/type/repository/hive/openhive.php', 'Hive', 'Hive', 500, 750, $strchooseafile); +//MW add image icon next to Hive... button + ?> + + + + + + + + diff --git a/mod/resource/type/repository/resource.class.php b/mod/resource/type/repository/resource.class.php index 052e6a74ebf..7ca909390ed 100644 --- a/mod/resource/type/repository/resource.class.php +++ b/mod/resource/type/repository/resource.class.php @@ -256,7 +256,7 @@ function display() { $inpopup = !empty($_GET["inpopup"]); - $fullurl = $CFG->hiveprot .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath . '?'. $resource->reference . '&HIVE_SESSION='.$SESSION->HIVE_SESSION; + $fullurl = $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath . '?'. $resource->reference . '&HIVE_SESSION='.$SESSION->HIVE_SESSION; if (!empty($querystring)) { $urlpieces = parse_url($resource->reference); @@ -267,6 +267,23 @@ function display() { } } + /// MW check that the HIVE_SESSION is there + if (empty($SESSION->HIVE_SESSION)) { + if ($inpopup) { + print_header($pagetitle, $course->fullname); + } else { + print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); + } + notify('You do not have access to HarvestRoad Hive. This resource is unavailable.'); + if ($inpopup) { + close_window_button(); + } + print_footer('none'); + die; + } + /// MW END + + /// Print a notice and redirect if we are trying to access a file on a local file system /// and the config setting has been disabled if (!$CFG->resource_allowlocalfiles and (strpos($resource->reference, RESOURCE_LOCALPATH) === 0)) {