[Home]WikiPatches/DoubleClick

UseModWiki | WikiPatches | RecentChanges | Preferences

This is an attempt for implementing in UseMod a modified fragment of UseModKr.

When browsing the wiki, users can edit a page simply by double-clicking on it (especially useful for long pages, if you don't want to scroll all the way down). The added value in this patch versus others DoubleClick is its functionality with old revisions. (Note that the user must have JavaScript enabled for the extension to work. If JavaScript is disabled, nothing will happen on a double-click).

The Patch

# Other global variables:
use vars qw(
...
+  $ClickEdit
  );

# Default configuration (used if UseConfig is 0)
...
  @ImageSites  = qw();            # Url prefixes of good image sites: ()=all
+  $ClickEdit   = 1;		   # 1 = edit page by double click on page, 0 = no use

sub DoBrowseRequest {
  } elsif ($action eq 'history') {
+    	  $ClickEdit = 0;
  
sub GetHtmlHeader {
- my ($title) = @_;
+  my ($title, $id) = @_;
+  my $revision = &GetParam('revision', '');
...
    $bodyExtra .= qq( BGCOLOR="$BGColor");
  }
+  if ($ClickEdit && &UserCanEdit($id,0)) {
+    if ($revision) {
+      $bodyExtra .= qq| ondblclick="location.href='$ScriptName${\(&ScriptLinkChar())}action=edit&id=$id&revision=$revision'" |;
+    } else {
+      $bodyExtra .= qq| ondblclick="location.href='$ScriptName${\(&ScriptLinkChar())}action=edit&id=$id'" |;
+    }
+  }

sub DoOtherRequest {
  my ($id, $action, $text, $search);
+  $ClickEdit = 0;

Links

The UseModKr core code: (http://gypark.pe.kr/pub/gyparkwiki/wiki/wiki.txt).

Other Perl-wikis with this feature or related: http://www.oddmuse.org/cgi-bin/wiki/Doubleclick_Extension.

--JuanmaMP


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 19, 2009 8:29 pm by JuanmaMP (diff)
Search: