Sidehistorik
...
Bemærk |
---|
Several Requirements are needed for the final page to be displayed correctly: Atlassian CLI (Notice the 3.X versions are not free, last free download versions at Atlassian CLI Script for making thumbnail images (makeThumbs.sh) User Macro: make-top (User Macro) User Macro: go-top (User Macro) User Macro: me-image - Image lightbox with Slimbox2 (User Macro) User Macro: include-lightbox - Slimbox2 including (In Custom HTML or Layout) User Macro: me-video - Linking to a Video file (User Macro) |
Executing the script:
...
./updateGallery.sh
...
directory="FamilieBilleder/2014" space="familiebilleder" pagetitle="Familiebilleder 2014" maketoc="yes"
Samples:
Kodeblok |
---|
./updateGallery.sh.multipage "FamilieBilleder/2012" "familiebilleder" "Familiebilleder 2012" yes 200 directory=[Dir] space=[SpaceName] pagetitle=[PageTitle] maketoc="yes|no" |
Samples:
Gives the Page - Familiebilleder 2012
...
Kodeblok | ||
---|---|---|
| ||
#!/bin/bash source config.txt IFS=$(echo -en "\n\b") # Arguments from command line for arg in "$@"; do if [[ $arg =~ ^([a-z_]+)=(.*)$ ]]; then key=${BASH_REMATCH[1]} value=${BASH_REMATCH[2]} case $key in directory) Dir="$value" ;; space) Space="$value" ;; pagetitle) PageTitle="$value" ;; maketoc) MakeToc="$value" ;; width) Width="$value" ;; grepfor) GrepFor="$value" ;; esac fi done # Check Arguments if [ $# -lt 4 ] then echo "There are not at least 4 Arguments: Dir Space PageTitle yes/no" exit 0 fi if [ ! -d $MediaRoot ] then echo "MediaRoot in config.txt: $MediaRoot does not exist" exit 0 fi if [ $Dir == "" ] then echo "Argument 1 is empty" exit 0 fi if [ ! -d $MediaRoot/$Dir ] then echo "Argument 1 Dir: $Dir does not exist under $MediaRoot" exit 0 fi if [ ! -d $CLIHome ] then echo "CLIHome in config.txt: $CLIHome does not exist" exit 0 fi if [ $MakeToc == "no" ] then echo "{make-top}" > $WikiFile else echo "{make-top}" > $WikiFile echo "{toc}" >> $WikiFile fi # Create Thumbnails for images and video if [ ! -e makeThumbs.sh ] then echo "makeThumbs.sh script not found here" exit 0 fi if [ ! $Width == "" ] then # Replace with from config.txt with command line argument width echo "Replacing config.txt ThumbSize $ThumbSize with argument $Width" ThumbSize=$Width fi ./makeThumbs.sh $ThumbSize $MediaRoot/"$Dir" ./makeThumbs.sh $DisplaySize $MediaRoot/"$Dir" cd $MediaRoot/"$Dir" # Create / update Parent - so we are sure it exists $CLIHome/confluence.sh --action storePage --space "$Space" --title "$PageTitle" --content "" for file in `find . -type d | grep -v "thumbs" | grep -v "cache" | egrep -i "$GrepFor" | sort` do if [ $file != "." ] then echo "" > $WikiPageFile echo $file NumOfPics=`ls -t "$file" | egrep -i "\.(jpg|jpeg|gif|png|avi|flv|mov)$" | wc -l` if [ $NumOfPics -gt 0 ] then # The Directory is not emtpy, so update and create it file=$(echo "$file"|sed 's/\.\///g') group=$file for image in `ls "$file" | egrep -i "\.(jpg|jpeg|gif|png)$"` do # Loop all images file2=$(echo "$file"|sed 's/ /%20/g') echo "{me-image:path=$Dir/$file2|image=$image|group=$group|thumbsize=$ThumbSize|displaysize=$DisplaySize}" >> $WikiPageFile done for movie in `ls "$file" | egrep -i "\.(flv|avi|mov)$"` do # Loop all video file2=$(echo "$file"|sed 's/ /%20/g') echo "{me-video:path=$Dir/$file2|image=$movie|thumbsize=$ThumbSize|displaysize=$DisplaySize}" >> $WikiPageFile done title=$(echo "$file"|sed 's/\//-/g') echo "h1. ${file}" >> $WikiFile echo "{go-top}" >> $WikiFile echo "{include:${title}}" >> $WikiFile echo "----" >> $WikiFile $CLIHome/confluence.sh --action storePage --space "$Space" --title "${title}" --parent "$PageTitle" --file $WikiPageFile --labels "noshow" fi fi done $CLIHome/confluence.sh --action storePage --space "$Space" --title "$PageTitle" --file $WikiFile rm $WikiPageFile rm $WikiFile |
...