Versioner sammenlignet

Nøgle

  • Linjen blev tilføjet.
  • Denne linje blev fjernet.
  • Formatering blev ændret.

...

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)

me-filecontent

 

Executing the script:

Kodeblok
./updateGalleryupdateFileContent.sh RelativeDirectory SpaceName PageName OpenMethod(same|new|lightbox) MakeTOC(yes|no eGrep)

Sample

Kodeblok
./updateGallery.sh "FamilieBillederFlashGames" DiverseSpace "Flash familiebillederGames" Christopherlightbox yes "Christopher|Stoffer"

Gives the Page - Christopher

...

ParameterDescription
RelativeDirectory

is the path to be traveled (this is /data/images/FamilieBilleder) for my installation, where /data/images is hardcoded in the script

SpaceName

is the Name of the Space where a page will be updated (or created)

PageNameis the Name of the Confluence page to be updated (or created) in the SpaceName Space
OpenMethodHow does the Content Opens - newwin=In a New Window, lightbox=In a lightbox, Default is the same browserwindow

yes|no

determines if a TOC markup is inserted at the top of the page

eGrep

is an optional RegEx string for fine-picking from the RelativeDirectory structure (blank selects all images/movies)

 

Source of the Script:

Kodeblok
linenumberstrue
#!/bin/bash

source config.txt

IFS=$(echo -en "\n\b")

# Arguments
Dir=$1
Space=$2
PageTitle=$3
OpenMethod=$4
MakeToc=$5
# Check Arguments
if [ $# -lt 5 ] 
then
	echo "There are not 5 required arguments: Directoryname Spacekey PageTitle OpenMethod(same|new|lightbox) MakeTOC(yes|no)"
	exit 0
fi
if [ ! -d $FileContentRoot ]
then
        echo "FileContentRoot in config.txt: $FileContentRoot does not exist"
        exit 0
fi
if [ $Dir == "" ]
then
	echo "Argument 1 is empty"
	exit 0
fi
if [ ! -d $FileContentRoot/$Dir ]
then
	echo "Argument 1 Dir: $Dir does not exist under $FileContentRoot"
	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
if [ $OpenMethod == "" ]
then
       OpenMethod == "same"
fi
cd $FileContentRoot/"$Dir"
for file in `find . -type d | grep -v "thumbs" | grep -v "cache" | sort`
do
	echo $file
	NumOfFiles=`ls -lt "$file" | awk 'NR!=1 && !/^d/ {print $NF}' | wc -l`
	if [ $NumOfFiles -gt 0 ]
	then
		file=$(echo "$file"|sed 's/\.\///g')
		if [ $file != "." ]
		then
			echo "h1. ${file}" >> $WikiFile
			echo "{go-top}" >> $WikiFile
		fi
		for content in `ls "$file"`
		do
			file2=$(echo "$file"|sed 's/ /%20/g')
			if [ $file2 == "." ]
			then
				file2=""
			fi

			echo "{me-filecontent:path=$Dir/$file2|file=$content|openmethod=$OpenMethod}" >> $WikiFile
		done
	fi
	
done

$CLIHome/confluence.sh --action storePage --space "$Space" --title "$PageTitle" --file $WikiFile

...