v_list_web_templates 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # info: listing web templates
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. format="${2-shell}"
  9. limit="${3-1000}"
  10. offset="${4-1}"
  11. # Importing variables
  12. source $VESTA/conf/vars.conf
  13. source $V_FUNC/shared_func.sh
  14. source $V_FUNC/domain_func.sh
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking arg number
  19. check_args '1' "$#" 'user'
  20. # Checking argument format
  21. format_validation 'user' 'limit' 'offset'
  22. # Checking user
  23. is_user_valid
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Get user package package
  28. templates=$(get_user_value '$WEB_TPL')
  29. # Listing domains
  30. case $format in
  31. json) webtpl_json_list ;;
  32. shell) webtpl_shell_list ;;
  33. *) check_args '1' "0" '[format] [limit] [offset]'
  34. esac
  35. #----------------------------------------------------------#
  36. # Vesta #
  37. #----------------------------------------------------------#
  38. # Logging
  39. log_event 'system' "$V_EVENT"
  40. exit $OK