From: <te...@us...> - 2004-07-19 21:42:44
|
Update of /cvsroot/tikiwiki/tiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28484 Modified Files: tiki-listpages.php Log Message: batch wiki page renaming in tiki-listpages.php Index: tiki-listpages.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/tiki-listpages.php,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- tiki-listpages.php 16 Jul 2004 19:26:40 -0000 1.18 +++ tiki-listpages.php 19 Jul 2004 21:42:33 -0000 1.19 @@ -60,7 +60,7 @@ foreach ($_REQUEST["checked"] as $deletepage) { $histlib->remove_all_versions($deletepage); - $tikifeedback[] = array('num'=>0,'mes'=>sprintf(tra("%s <b>%s</b> successfully deleted."),tra("page"),$deletepage)); + $tikifeedback[] = array('num'=>0,'mes'=>sprintf(tra("Page <b>%s</b> successfully deleted."),$deletepage)); } } elseif ($_REQUEST['submit_mult'] == 'categorize') { $categorize_mode = TRUE; @@ -68,6 +68,9 @@ include_once ('lib/categories/categlib.php'); $categories = $categlib->list_categs(); $smarty->assign('categories', $categories); + } elseif ($_REQUEST['submit_mult'] == 'rename') { + $rename_mode = TRUE; + $smarty->assign('rename_mode', 'y'); } } // to-do: place the following code in categorize.php? @@ -100,7 +103,7 @@ $catObjectId = $categlib->add_categorized_object($cat_type, $cat_objid, $cat_desc, $cat_name, $cat_href); } $categlib->categorize($catObjectId, $cat_acat); - $tikifeedback[] = array('num'=>0,'mes'=>sprintf(tra("%s <b>%s</b> added to %s <b>%s</b>."),tra("page"),$cat_objid,tra("category"),$categ_object['name'])); + $tikifeedback[] = array('num'=>0,'mes'=>sprintf(tra("Page <b>%s</b> added to %s <b>%s</b>."),$cat_objid,tra("category"),$categ_object['name'])); } } } @@ -128,12 +131,27 @@ $catObjectId = $categlib->is_categorized($cat_type, $cat_objid); if ($catObjectId) { $categlib->remove_object_from_category($catObjectId, $cat_acat); - $tikifeedback[] = array('num'=>0,'mes'=>sprintf(tra("%s <b>%s</b> removed from %s <b>%s</b>."),tra("page"),$cat_objid,tra("category"),$categ_object['name'])); + $tikifeedback[] = array('num'=>0,'mes'=>sprintf(tra("Page <b>%s</b> removed from %s <b>%s</b>."),$cat_objid,tra("category"),$categ_object['name'])); } } } } } +// mass page renaming +elseif (!empty($_REQUEST['newpages'])) { + $newpages = $_REQUEST['newpages']; + global $wikilib; + if (!is_object($wikilib)) { + include_once ('lib/wiki/wikilib.php'); + } + foreach ($newpages as $oldpage => $newpage) { + if ($wikilib->wiki_rename_page($oldpage, $newpage)) { + $tikifeedback[] = array('num'=>0,'mes'=>sprintf(tra("Page <b>%s</b> renamed to <b>%s</b>."),$oldpage,$newpage)); + } else { + $tikifeedback[] = array('num'=>0,'mes'=>sprintf(tra("Failed to rename page <b>%s</b> to <b>%s</b>; perhaps <b>%s</b> already exists."),$oldpage,$newpage,$newpage)); + } + } +} // This script can receive the thresold // for the information as the number of @@ -173,7 +191,7 @@ // Get a list of last changes to the Wiki database $listpages = $tikilib->list_pages($offset, $maxRecords, $sort_mode, $find); -if (!empty($categorize_mode)) { +if (!empty($categorize_mode) || !empty($rename_mode)) { $arraylen = count($listpages['data']); for ($i=0; $i<$arraylen; $i++) { if (in_array($listpages['data'][$i]['pageName'], $_REQUEST["checked"])) { |