if (has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_MODULE, $moduleid))) {
$string = get_string('updatethis', '', $string);
- return "<form $CFG->frametarget method=\"get\" action=\"$CFG->wwwroot/course/mod.php\">".
+ return "<form $CFG->frametarget method=\"get\" action=\"$CFG->wwwroot/course/mod.php\" onsubmit=\"this.target='{$CFG->framename}'; return true\">".//hack to allow edit on framed resources
"<fieldset class='invisiblefieldset'>".
"<input type=\"hidden\" name=\"update\" value=\"$moduleid\" />".
"<input type=\"hidden\" name=\"return\" value=\"true\" />".
if ($resource = get_record("resource", "id", $coursemodule->instance)) {
if (!empty($resource->popup)) {
- $info->extra = urlencode("target=\"resource$resource->id\" onclick=\"return ".
+ $info->extra = urlencode("onclick=\"this.target='resource$resource->id'; return ".
"openpopup('/mod/resource/view.php?inpopup=true&id=".
$coursemodule->id.
"','resource$resource->id','$resource->popup');\"");
require_once($CFG->libdir.'/filelib.php');
- $subdir = optional_param( 'subdir','' );
+ $subdir = optional_param('subdir','', PARAM_PATH);
+ $resource->reference = clean_param($resource->reference, PARAM_PATH);
- add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
+ $formatoptions = new object();
+ $formatoptions->noclean = true;
+ add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
if ($resource->reference) {
- if (detect_munged_arguments($resource->reference, 0)) {
- error("The filename contains illegal characters!");
- }
$relativepath = "{$course->id}/{$resource->reference}";
} else {
$relativepath = "{$course->id}";
}
if ($subdir) {
- if (detect_munged_arguments($subdir, 0)) {
- error("The value for 'subdir' contains illegal characters!");
- }
$relativepath = "$relativepath$subdir";
if (stripos($relativepath, 'backupdata') !== FALSE or stripos($relativepath, $CFG->moddata) !== FALSE) {
error("Access not allowed!");
$pagetitle = strip_tags($course->shortname.': '.format_string($resource->name));
+ $update = update_module_button($cm->id, $course->id, $this->strresource);
+ if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $course->id))) {
+ $options = array('id'=>$course->id, 'wdir'=>'/'.$resource->reference.$subdir);
+ $editfiles = print_single_button("$CFG->wwwroot/files/index.php", $options, get_string("editfiles"), 'get', '', true);
+ $update = $editfiles.$update;
+ }
print_header($pagetitle, $course->fullname, "$this->navigation $subnav",
- "", "", true, update_module_button($cm->id, $course->id, $this->strresource),
+ "", "", true, $update,
navmenu($course, $cm));
- if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $course->id))) {
- echo "<div align=\"right\"><img src=\"$CFG->pixpath/i/files.gif\" height=\"16\" width=\"16\" alt=\"\" /> ".
- "<a href=\"$CFG->wwwroot/files/index.php?id={$course->id}&wdir=/{$resource->reference}$subdir\">".
- get_string("editfiles")."...</a></div>";
- }
if (trim(strip_tags($resource->summary))) {
- $formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
print_spacer(10,10);
}
$strfolder = get_string("folder");
$strfile = get_string("file");
- echo '<table cellpadding="4" cellspacing="1" class="files">';
+ echo '<table cellpadding="4" cellspacing="1" class="files" summary="">';
echo "<tr><th class=\"header name\" scope=\"col\">$strname</th>".
"<th align=\"right\" colspan=\"2\" class=\"header size\" scope=\"col\">$strsize</th>".
"<th align=\"right\" class=\"header date\" scope=\"col\">$strmodified</th>".
if ($icon == 'folder.gif') {
echo '<tr class="folder">';
- echo '<td nowrap="nowrap" class="name">';
+ echo '<td class="name">';
echo "<a href=\"view.php?id={$cm->id}&subdir=$subdir/$file\">";
echo "<img src=\"$CFG->pixpath/f/$icon\" width=\"16\" height=\"16\" alt=\"$strfolder\" /> $file</a>";
} else {
echo '<tr class="file">';
- echo '<td nowrap="nowrap" class="name">';
+ echo '<td class="name">';
link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "<img src=\"$CFG->pixpath/f/$icon\" width=\"16\" height=\"16\" alt=\"$strfile\" /> $file", 450, 600, '');
}
echo '</td>';
echo '<td> </td>';
- echo '<td align="right" nowrap="nowrap" class="size">';
+ echo '<td align="right" class="size">';
echo $filesize;
echo '</td>';
- echo '<td align="right" nowrap="nowrap" class="date">';
+ echo '<td align="right" class="date">';
echo userdate(filemtime("$CFG->dataroot/$relativepath/$file"), $strftime);
echo '</td>';
echo '</tr>';
$mimetype = mimeinfo("type", $resource->reference);
$pagetitle = strip_tags($course->shortname.': '.format_string($resource->name));
+ $formatoptions = new object();
+ $formatoptions->noclean = true;
+
if ($resource->options != "frame") {
if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))) { // It's an image
$resourcetype = "image";
echo '</script>';
if (trim(strip_tags($resource->summary))) {
- $formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
}
- $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
+ $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
- echo "<p> </p>";
- echo '<p align="center">';
+ echo '<div class="popupnotice">';
print_string('popupresource', 'resource');
echo '<br />';
print_string('popupresourcelink', 'resource', $link);
- echo "</p>";
+ echo '</div>';
print_footer($course);
exit;
/// Now check whether we need to display a frameset
- $frameset = optional_param( 'frameset','' );
+ $frameset = optional_param('frameset', '', PARAM_ALPHA);
if (empty($frameset) and !$embedded and !$inpopup and ($resource->options == "frame") and empty($USER->screenreader)) {
@header('Content-Type: text/html; charset=utf-8');
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
if (!empty( $frameset ) and ($frameset == "top") ) {
print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
+ $options = new object();
$options->para = false;
echo '<div class="summary">'.format_text($resource->summary, FORMAT_HTML, $options).'</div>';
if (!empty($localpath)) { // Show some help
link_to_popup_window ('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp','resource'), 400, 500, get_string('localfilehelp', 'resource'));
echo '</div>';
}
- echo '</body></html>';
+ echo '</div></div></body></html>';
exit;
}
}
if ($resourcetype == "image") {
- echo "<center><p>";
+ echo '<div class="resourcecontent">';
echo "<img title=\"".strip_tags(format_string($resource->name,true))."\" class=\"resourceimage\" src=\"$fullurl\" alt=\"\" />";
- echo "</p></center>";
+ echo '</div>';
} else if ($resourcetype == "mp3") {
if (!empty($THEME->resource_mp3player_colors)) {
}
$c .= '&volText='.get_string('vol', 'resource').'&panText='.get_string('pan','resource');
$c = htmlentities($c);
+ echo '<div class="resourcecontent">';
echo '<div class="mp3player" align="center">';
echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
echo ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
echo '</embed>';
echo '</object>';
echo '</div>';
+ echo '</div>';
} else if ($resourcetype == "mediaplayer") {
- echo "<center><p>";
+ echo '<div class="resourcecontent">';
echo '<object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"';
echo ' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
echo ' standby="Loading Microsoft� Windows� Media Player components..." ';
echo ' pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/">';
echo '</embed>';
echo '</object>';
- echo "</p></center>";
+ echo '</div>';
} else if ($resourcetype == "quicktime") {
- echo "<center><p>";
+ echo '<div class="resourcecontent">';
echo '<object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
echo ' codebase="http://www.apple.com/qtactivex/qtplugin.cab" ';
echo ' height="450" width="600"';
echo ' pluginspage="http://quicktime.apple.com/">';
echo '</embed>';
echo '</object>';
- echo "</p></center>";
+ echo '</div>';
}
if (trim($resource->summary)) {
- $formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
}
if ($inpopup) {
- echo "<center><p>(<a href=\"$fullurl\">$strdirectlink</a>)</p></center>";
+ echo "<div class=\"popupnotice\">(<a href=\"$fullurl\">$strdirectlink</a>)</div>";
} else {
print_spacer(20,20);
print_footer($course);
echo '<div align="right" class="helplink">';
link_to_popup_window ('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp','resource'), 400, 500, get_string('localfilehelp', 'resource'));
echo '</div>';
- echo "<center><p>(<a href=\"$fullurl\">$fullurl</a>)</p></center>";
+ echo "<div class=\"popupnotice\">(<a href=\"$fullurl\">$fullurl</a>)</div>";
}
redirect($fullurl);
}
function display() {
global $CFG;
+
+ $formatoptions = new object();
+ $formatoptions->noclean = true;
/// Are we displaying the course blocks?
if ($this->resource->options == 'showblocks') {
parent::display_course_blocks_start();
- $formatoptions->noclean = true;
echo format_text($this->resource->alltext, FORMAT_HTML, $formatoptions, $this->course->id);
parent::display_course_blocks_end();
$resource = $this->resource;
$pagetitle = strip_tags($course->shortname.': '.format_string($resource->name));
- $formatoptions->noclean = true;
- $inpopup_param = optional_param( 'inpopup','' );
- $inpopup = !empty($inpopup_param);
+ $inpopup = optional_param('inpopup', '', PARAM_BOOL);
if ($resource->popup) {
if ($inpopup) { /// Popup only
navmenu($course, $cm));
echo "\n<script type=\"text/javascript\">";
- echo "\n<!--\n";
+ echo "\n//<![CDATA[\n";
echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
- echo "\n-->\n";
+ echo "\n//]]>\n";
echo '</script>';
if (trim(strip_tags($resource->summary))) {
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
}
- $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
+ $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
- echo "<p> </p>";
- echo '<p align="center">';
+ echo '<div class="popupnotice">';
print_string('popupresource', 'resource');
echo '<br />';
print_string('popupresourcelink', 'resource', $link);
- echo "</p>";
+ echo '</div>';
print_footer($course);
}
print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center", "", "", "20");
$strlastmodified = get_string("lastmodified");
- echo "<center><p><font size=\"1\">$strlastmodified: ".userdate($resource->timemodified)."</font></p></center>";
+ echo "<div class=\"modified\">$strlastmodified: ".userdate($resource->timemodified)."</div>";
print_footer($course);
}
function display() {
global $CFG;
+ $formatoptions = new object();
+ $formatoptions->noclean = true;
/// Are we displaying the course blocks?
if ($this->resource->options == 'showblocks') {
parent::display_course_blocks_start();
- $formatoptions->noclean = true;
-
if (trim(strip_tags($this->resource->summary))) {
echo format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id);
}
$resource = $this->resource;
$pagetitle = strip_tags($course->shortname.': '.format_string($resource->name));
- $formatoptions->noclean = true;
- $inpopup_param = optional_param( 'inpopup', '' );
- $inpopup = !empty($inpopup_param);
+ $inpopup = optional_param('inpopup', '', PARAM_BOOL);
if ($resource->popup) {
if ($inpopup) { /// Popup only
navmenu($course, $cm));
echo "\n<script type=\"text/javascript\">";
- echo "\n<!--\n";
+ echo "\n//<![CDATA[\n";
echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
- echo "\n-->\n";
+ echo "\n//]]>\n";
echo '</script>';
if (trim(strip_tags($resource->summary))) {
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
}
- $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
+ $link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
- echo "<p> </p>";
- echo '<p align="center">';
+ echo '<div class="popupnotice">';
print_string('popupresource', 'resource');
echo '<br />';
print_string('popupresourcelink', 'resource', $link);
- echo "</p>";
+ echo '</div>';
print_footer($course);
}
"center", "", "", "20");
$strlastmodified = get_string("lastmodified");
- echo "<center><p><font size=\"1\">$strlastmodified: ".userdate($resource->timemodified)."</font></p></center>";
+ echo "<div class=\"modified\">$strlastmodified: ".userdate($resource->timemodified)."</div>";
print_footer($course);
}
font-size:0.8em;
}
+.mod-resource .modified {
+ font-size:0.6em;
+}
+
.ims-nav-dimmed,
.ims-nav-button {
font-size:0.8em;
width: 100%;
}
-.navbar .navbutton form {
+.navbar .navbutton {
+ margin-top: 3px;
float: left;
}
-.navbar .navbutton {
- margin-top: 3px;
+.navbar .navbutton div,
+.navbar .navbutton form {
+ display:inline;
+ margin:0px;
+ padding:0px;
}
.navbar .breadcrumb {
text-align: center;
}
-/* .navbutton form {
- display: inline;
- } */
-
/***
*** Modules: Resource
***/
+#mod-resource-view .resourcecontent {
+ text-align:center;
+ margin:20px;
+}
+
+.mod-resource .modified {
+ text-align:center;
+}
+
+.mod-resource .popupnotice {
+ text-align:center;
+ margin:40px;
+}
+
.ims-nav-bar {
position: relative;
padding:0.1em;