Skip to content

Commit

Permalink
Item9750: Add a utility topic to load webs automatically
Browse files Browse the repository at this point in the history
This topic depends on SEARCH{ web="all"} giving a current list of
webs, which might be a bit catch-22 later on down the track if/when
MongoDBPlugin replaces the getListOfWebs functionality....

git-svn-id: http://svn.foswiki.org/trunk/MongoDBPlugin@9579 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
PaulHarvey authored and PaulHarvey committed Oct 17, 2010
1 parent 4f54fe5 commit 8f77296
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
75 changes: 75 additions & 0 deletions data/System/MongoDBLoadWebs.txt
@@ -0,0 +1,75 @@
%META:TOPICPARENT{name="MongoDBPlugin"}%

---++ MongoDBPlugin load webs utility

<a id="mongoloadall" href="#">Load all</a>, or load individually:

| *Web* | *Action* |
%SEARCH{
"name='WebPreferences'"
type="query"
web="all"
recurse="on"
nonoise="on"
format="| [[$web.$topic][$web]] | <span class='mongoweb'><a class='mongoloadone' href='#'>load</a>\
<span class='mongowebname' style='display: none;'><literal>$web</literal></span>\
<span class='mongowebresult'></span></span>|"
}%

<!--
%ADDTOZONE{
"script"
requires="JQUERYPLUGIN"
topic="%TOPIC%"
section="js"
}%
%STARTSECTION{"js"}%<script type="text/javascript">
jQuery(document).ready(
function ($) {
var doWeb = function (element) {
var webname = $(element).children('.mongowebname').text();
$(element).children('.mongowebresult').load('%SCRIPTURLPATH{"rest"}%/MongoDBPlugin/update?updateweb=' + webname);

return;
},
webIndex = 0,
webs = $('.mongoweb'),
doNextWeb = function () {
var webname, element;

if (webIndex < webs.length) {
element = webs[webIndex];
webIndex = webIndex + 1;
webname = $(element).children('.mongowebname').text();
$(element).children('.mongowebresult').load(
'%SCRIPTURLPATH{"rest"}%/MongoDBPlugin/update?updateweb=' + webname,
doNextWeb
);
}

return;
};

$('.mongoloadone').each(
function (index, element) {
$(element).click(
function () {
doWeb($(element).parent());

return false;
}
);
}
);

$('#mongoloadall').click(
function () {
doNextWeb();

return false;
}
);
}
);
</script>%ENDSECTION{"js"}%
-->
1 change: 1 addition & 0 deletions data/System/MongoDBPlugin.txt
@@ -1,3 +1,4 @@
%META:TOPICPARENT{name="Plugins"}%
---+!! !MongoDBPlugin
<!--
One line description, required for extensions repository catalog.
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/MongoDBPlugin/MANIFEST
@@ -1,5 +1,6 @@
# Release manifest for MongoDBPlugin
data/System/MongoDBPlugin.txt 0644 Documentation
data/System/MongoDBLoadWebs.txt 0644 Utility Topic
lib/Foswiki/Plugins/MongoDBPlugin.pm 0644 Perl module
lib/Foswiki/Plugins/MongoDBPlugin/DB.pm 0644 Perl module
lib/Foswiki/Plugins/MongoDBPlugin/Meta.pm 0644 Perl module
Expand Down

0 comments on commit 8f77296

Please sign in to comment.