* @param string $pagename Name of page.
* @return array Two-element array with a boolean true (if lock has been obtained)
* or false (if lock was held by somebody else). If lock was held by someone else,
- * the values of the wiki_locks entry are held in the second element.
+ * the values of the wiki_locks entry are held in the second element; if lock was
+ * held by current user then the the second element has a member ->id only.
*/
function wiki_obtain_lock($wikiid,$pagename) {
global $USER;
$_SESSION[SESSION_WIKI_LOCKS]=array();
}
$_SESSION[SESSION_WIKI_LOCKS][$wikiid.'_'.$pagename]=$lockid;
- return array(true,null);
+ $lockdata=new StdClass;
+ $lockdata->id=$lockid;
+ return array(true,$lockdata);
}
/**
require_once("lib.php");
#require_once("$CFG->dirroot/course/lib.php"); // For side-blocks
require_once($CFG->libdir . '/ajax/ajaxlib.php');
+ require_js(array('yui_yahoo','yui_connection'));
$ewiki_action = optional_param('ewiki_action', '', PARAM_ALPHA); // Action on Wiki-Page
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
";
}
} else {
- // OK, the page is now locked to us. Put in the AJAX for keeping the lock
- print require_js(array('yui_yahoo','yui_connection'));
+ // OK, the page is now locked to us. Put in the AJAX for keeping the lock
$strlockcancelled=get_string('lockcancelled','wiki');
$strnojslockwarning=get_string('nojslockwarning','wiki');
$intervalms=WIKI_LOCK_RECONFIRM*1000;
}
intervalID=setInterval(function() {
YAHOO.util.Connect.asyncRequest('POST','confirmlock.php',
- {success:handleResponse,failure:handleFailure},'lockid=$lockid');
+ {success:handleResponse,failure:handleFailure},'lockid={$lock->id}');
},$intervalms);
</script>
<noscript><p>
$strnojslockwarning
</p></noscript>
";
-
// Print editor etc
print $content;
}