Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item9750: Add a utility topic to load webs automatically
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
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"}% | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters