[Home]WikiPatches/EditIntermap

UseModWiki | WikiPatches | RecentChanges | Preferences

By analogy with editbanned, this patch allow to keep the file InterMap from the own wiki site, via adminbar.

The Patch

For instance after sub DoUpdateBanned (completely optional):
+  sub DoEditIntermap {
+    my ($intermapList, $status);
+  
+    print &GetHeader("", "Editing IntermapList", "");
+    print "\n"; 
+    return  if (!&UserIsAdminOrError());
+    ($status, $intermapList) = &ReadFile("$DataDir/intermap");
+    $intermapList = ""  if (!$status);
+    print &GetFormStart();
+    print GetHiddenValue("edit_intermap", 1), "\n";
+    print &GetTextArea('intermaplist', $intermapList, 12, 100);
+    print "<br>", $q->submit(-name=>'Save'), "\n";
+    print $q->endform;
+    print '</div>' . &GetCommonFooter();
+  }
+  
+  sub DoUpdateIntermap {
+    my ($newList, $fname);
+  
+    print &GetHeader("", "Updating Intermap list", "");
+    return  if (!&UserIsAdminOrError());
+    $fname = "$DataDir/intermap";
+    $newList = &GetParam("intermaplist", "#Empty file");
+    if ($newList eq "") {
+    print "<p>Empty intermap list or error.";
+    print "<p>Resubmit with at least one space character to remove.";
+    } elsif ($newList =~ /^\s*$/s) {
+    unlink($fname);
+    print "<p>Removed intermap list";
+    } else {
+    &WriteStringToFile($fname, $newList);
+    print "<p>Updated intermap list";
+    }
+    print '</div>' . &GetCommonFooter();
+  }

Sub GetAdminBar {
....
  $result .= &ScriptLink("action=editbanned", T("Edit Banned List"));
+  $result .= ' | ' . &ScriptLink("action=editintermap",T("Intermap"));
...
}

Sub DoOtherRequest {
...
} elsif ($action eq "editbanned") {
      &DoEditBanned();
+    } elsif ($action eq "editintermap") {
+      &DoEditIntermap();
...
sub DoOtherRequest {
...
if (&GetParam("edit_ban", 0)) {
    &DoUpdateBanned();
    return;
  }
+  if (&GetParam("edit_intermap", 0)) {
+	&DoUpdateIntermap();
+	return;
+    }
If the script runs as "www-data", then the wikidb, etc. files must also be owned by "www-data", (apache2 runs as user www-data, for instance). See the documentation of your web server for details. (See cuestion: Q: What should the following file permissions be? at UseModWiki/Install)

To-Do

Some explain and examples By analogy with editbanned, preceding the insertion of InterMap lines.

In fact, all the files out of subdirectories can be accessed from web, in the same manner, taking into account security considerations.

--JuanmaMP


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 25, 2009 3:51 am by JuanmaMP (diff)
Search: