You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
840 lines
35 KiB
840 lines
35 KiB
#!/bin/bash
|
|
# =============================================================================
|
|
# Instalador AGC: custom.css + logos (LogoHome, LogoAgent)
|
|
# Ubicación: agc/css/installer/
|
|
# =============================================================================
|
|
#
|
|
# Referencias CSS: vicidial_stylesheet, admin_header, VERM_admin, VERM_header.inc
|
|
# (VERM_main_report_page), VERM_wallboards, VERM_custom_report; importación directa:
|
|
# realtime_report.php, welcome.php, hci_screen.php.
|
|
#
|
|
# CONTENIDO DE installer/:
|
|
# - custom.css → hoja de estilos (se copia a agc/css/custom.css)
|
|
# - LogoHome.png → logo para Welcome y Agent login
|
|
# - LogoAgent.png → logo para la página de agente (una vez logueado)
|
|
# - install_custom_css.sh (este script)
|
|
#
|
|
# GUÍA DE INSTALACIÓN (también en custom.css al inicio):
|
|
# 1. Import en vicidial_stylesheet.php (al inicio del CSS) para la mayoría de pantallas.
|
|
# 2. Link en admin_header.php (antes de </head>) para pantallas que usan admin_header.
|
|
# 3. Link en VERM/VERM_admin.php (tras VERM_stylesheet.php) para la interfaz VERM admin.
|
|
# 4. Link en VERM/VERM_wallboards.php (tras VERM_wallboard_stylesheet.php) para el wallboard.
|
|
# 5. Link en VERM/VERM_custom_report.php (tras VERM_stylesheet.php) para el formulario de custom report.
|
|
# 6. Link en VERM/VERM_header.inc (tras VERM_stylesheet.php) para VERM_main_report_page.php y páginas que usan este header.
|
|
# 7. Importación directa en vicidial/realtime_report.php, vicidial/welcome.php, vicidial/hci_screen.php (no usan solo admin_header/vicidial_stylesheet).
|
|
# 8. Welcome y agent login usan el logo en vicidial/images y agc/images respectivamente.
|
|
# 9. La página de agente usa el logo en agc/images (mismo archivo que login por defecto).
|
|
#
|
|
# LOGOS:
|
|
# - LogoHome.png → Welcome, Admin (vicidial/images + .gif en raíz vicidial) y VERM (VERM/images para VERM_admin.php).
|
|
# - LogoAgent.png → Solo agente: login (agc/images/vicidial_admin_web_logo.png) y
|
|
# panel una vez logueado (agc/images/agc_agent_logo.png).
|
|
#
|
|
# BACKUP DE IMÁGENES: antes de sustituir, se guarda la actual como *NombreOriginal*_OldCustom.ext.
|
|
# BACKUP DE custom.css: si agc/css/custom.css ya existe, se guarda como custom.css.bak.pre_agc antes de copiar.
|
|
# RESTAURAR (uninstall): restaura referencias CSS desde .bak.pre_agc y logos desde *_OldCustom; custom.css se deja en blanco con comentario "Custom desinstalado".
|
|
#
|
|
# Uso (ruta absoluta):
|
|
# /srv/www/htdocs/agc/css/installer/install_custom_css.sh [ install | uninstall | status ]
|
|
# HTDOCS=/ruta/htdocs /srv/www/htdocs/agc/css/installer/install_custom_css.sh install # otro ViciDial
|
|
# =============================================================================
|
|
|
|
set -e
|
|
|
|
INSTALADOR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
AGC_DIR="$(dirname "$(dirname "$INSTALADOR_DIR")")"
|
|
HTDOCS="${HTDOCS:-$(dirname "$AGC_DIR")}"
|
|
VICIDIAL_DIR="${HTDOCS}/vicidial"
|
|
VICIDIAL_IMAGES="${VICIDIAL_DIR}/images"
|
|
CUSTOM_CSS_SOURCE="${INSTALADOR_DIR}/custom.css"
|
|
CUSTOM_CSS_DEST="${AGC_DIR}/css/custom.css"
|
|
IMAGES_AGC="${AGC_DIR}/images"
|
|
VICIDIAL_STYLESHEET="${VICIDIAL_DIR}/vicidial_stylesheet.php"
|
|
ADMIN_HEADER="${VICIDIAL_DIR}/admin_header.php"
|
|
REALTIME_REPORT_PHP="${VICIDIAL_DIR}/realtime_report.php"
|
|
WELCOME_PHP="${VICIDIAL_DIR}/welcome.php"
|
|
HCI_SCREEN_PHP="${VICIDIAL_DIR}/hci_screen.php"
|
|
VERM_DIR="${HTDOCS}/VERM"
|
|
VERM_IMAGES="${VERM_DIR}/images"
|
|
VERM_ADMIN_PHP="${VERM_DIR}/VERM_admin.php"
|
|
VERM_HEADER_INC="${VERM_DIR}/VERM_header.inc"
|
|
VERM_WALLBOARDS_PHP="${VERM_DIR}/VERM_wallboards.php"
|
|
VERM_CUSTOM_REPORT_PHP="${VERM_DIR}/VERM_custom_report.php"
|
|
VICIDIAL_PHP="${AGC_DIR}/vicidial.php"
|
|
TIMECLOCK_PHP="${AGC_DIR}/timeclock.php"
|
|
VDC_SCRIPT_NOTES_PHP="${AGC_DIR}/vdc_script_notes.php"
|
|
|
|
# Nombres de logos en destino (sin ruta)
|
|
LOGO_WELCOME_NAME="vicidial_admin_web_logo.png"
|
|
LOGO_AGENT_LOGIN_NAME="vicidial_admin_web_logo.png"
|
|
LOGO_AGENT_PAGE_NAME="agc_agent_logo.png"
|
|
LOGO_ADMIN_GIF_NAME="vicidial_admin_web_logo.gif"
|
|
OLDCUSTOM_SUFFIX="_OldCustom"
|
|
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
info() { echo -e "${GREEN}[INFO]${NC} $1"; }
|
|
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
|
|
|
# --- Backup/restore para archivos modificados (referencias CSS) ---
|
|
BACKUP_SUFFIX=".bak.pre_agc"
|
|
save_pre_agc_backup() {
|
|
local file="$1"
|
|
[[ -f "$file" ]] || return 0
|
|
cp -a "$file" "${file}${BACKUP_SUFFIX}"
|
|
info "Backup para restauración: ${file}${BACKUP_SUFFIX}"
|
|
}
|
|
restore_from_pre_agc_backup() {
|
|
local file="$1"
|
|
local backup="${file}${BACKUP_SUFFIX}"
|
|
if [[ -f "$backup" ]]; then
|
|
cp -a "$backup" "$file"
|
|
rm -f "$backup"
|
|
info "Restaurado: $file"
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
# --- Logo: guardar original como *Nombre*_OldCustom.ext y poner el nuevo con nombre original ---
|
|
install_logo_file() {
|
|
local src="$1"
|
|
local dest_dir="$2"
|
|
local dest_name="$3"
|
|
local dest_path="${dest_dir}/${dest_name}"
|
|
local ext="${dest_name##*.}"
|
|
local base="${dest_name%.*}"
|
|
local backup_path="${dest_dir}/${base}${OLDCUSTOM_SUFFIX}.${ext}"
|
|
if [[ ! -f "$src" ]]; then
|
|
warn "No encontrado: $src (se omite)."
|
|
return 0
|
|
fi
|
|
if [[ ! -d "$dest_dir" ]]; then
|
|
warn "No existe el directorio: $dest_dir (se omite)."
|
|
return 0
|
|
fi
|
|
if [[ -f "$dest_path" ]] && [[ ! -f "$backup_path" ]]; then
|
|
cp -a "$dest_path" "$backup_path"
|
|
info "Backup de imagen (original para desinstalar): $backup_path"
|
|
fi
|
|
cp -a "$src" "$dest_path"
|
|
info "Logo instalado: $dest_path"
|
|
}
|
|
|
|
# --- Restaurar logo desde *_OldCustom ---
|
|
restore_logo_file() {
|
|
local dest_dir="$1"
|
|
local dest_name="$2"
|
|
local ext="${dest_name##*.}"
|
|
local base="${dest_name%.*}"
|
|
local backup_path="${dest_dir}/${base}${OLDCUSTOM_SUFFIX}.${ext}"
|
|
if [[ ! -f "$backup_path" ]]; then
|
|
return 1
|
|
fi
|
|
cp -a "$backup_path" "${dest_dir}/${dest_name}"
|
|
rm -f "$backup_path"
|
|
info "Restaurado logo: ${dest_dir}/${dest_name}"
|
|
return 0
|
|
}
|
|
|
|
installed_stylesheet() {
|
|
[[ -f "$VICIDIAL_STYLESHEET" ]] && grep -q "agc/css/custom.css" "$VICIDIAL_STYLESHEET"
|
|
}
|
|
installed_admin_header() {
|
|
[[ -f "$ADMIN_HEADER" ]] && grep -q "agc/css/custom.css" "$ADMIN_HEADER"
|
|
}
|
|
|
|
installed_verm_ref() {
|
|
[[ -f "$VERM_ADMIN_PHP" ]] && grep -q "agc/css/custom.css" "$VERM_ADMIN_PHP"
|
|
}
|
|
|
|
installed_verm_wallboard_ref() {
|
|
[[ -f "$VERM_WALLBOARDS_PHP" ]] && grep -q "agc/css/custom.css" "$VERM_WALLBOARDS_PHP"
|
|
}
|
|
|
|
installed_verm_custom_report_ref() {
|
|
[[ -f "$VERM_CUSTOM_REPORT_PHP" ]] && grep -q "agc/css/custom.css" "$VERM_CUSTOM_REPORT_PHP"
|
|
}
|
|
|
|
installed_verm_header_ref() {
|
|
[[ -f "$VERM_HEADER_INC" ]] && grep -q "agc/css/custom.css" "$VERM_HEADER_INC"
|
|
}
|
|
|
|
installed_realtime_report_ref() {
|
|
[[ -f "$REALTIME_REPORT_PHP" ]] && grep -q "agc/css/custom.css" "$REALTIME_REPORT_PHP"
|
|
}
|
|
installed_welcome_ref() {
|
|
[[ -f "$WELCOME_PHP" ]] && grep -q "agc/css/custom.css" "$WELCOME_PHP"
|
|
}
|
|
installed_hci_screen_ref() {
|
|
[[ -f "$HCI_SCREEN_PHP" ]] && grep -q "agc/css/custom.css" "$HCI_SCREEN_PHP"
|
|
}
|
|
|
|
installed_vdc_script_notes_ref() {
|
|
[[ -f "$VDC_SCRIPT_NOTES_PHP" ]] && grep -q 'css/custom\.css' "$VDC_SCRIPT_NOTES_PHP"
|
|
}
|
|
|
|
# --- Copiar custom.css: hacer backup del destino si existe, luego copiar desde installer ---
|
|
copy_custom_css() {
|
|
if [[ ! -f "$CUSTOM_CSS_SOURCE" ]]; then
|
|
error "No se encuentra custom.css en: $CUSTOM_CSS_SOURCE"
|
|
exit 1
|
|
fi
|
|
if [[ -f "$CUSTOM_CSS_DEST" ]]; then
|
|
cp -a "$CUSTOM_CSS_DEST" "${CUSTOM_CSS_DEST}${BACKUP_SUFFIX}"
|
|
info "Backup del custom.css actual: ${CUSTOM_CSS_DEST}${BACKUP_SUFFIX}"
|
|
fi
|
|
cp -a "$CUSTOM_CSS_SOURCE" "$CUSTOM_CSS_DEST"
|
|
info "custom.css copiado a $CUSTOM_CSS_DEST"
|
|
}
|
|
|
|
# --- Instalar referencias a custom.css (vicidial_stylesheet y admin_header) ---
|
|
install_stylesheet_ref() {
|
|
if installed_stylesheet; then
|
|
info "vicidial_stylesheet.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VICIDIAL_STYLESHEET" ]]; then
|
|
warn "No existe: $VICIDIAL_STYLESHEET"
|
|
return 1
|
|
fi
|
|
save_pre_agc_backup "$VICIDIAL_STYLESHEET"
|
|
local line_num
|
|
line_num=$(grep -n '?>' "$VICIDIAL_STYLESHEET" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { error "No se encontró ?> en vicidial_stylesheet.php"; return 1; }
|
|
head -n "$line_num" "$VICIDIAL_STYLESHEET" > "${VICIDIAL_STYLESHEET}.tmp"
|
|
echo "" >> "${VICIDIAL_STYLESHEET}.tmp"
|
|
echo "/* Importar estilos personalizados AGC (debe ir al inicio) */" >> "${VICIDIAL_STYLESHEET}.tmp"
|
|
echo "@import url('../agc/css/custom.css');" >> "${VICIDIAL_STYLESHEET}.tmp"
|
|
echo "" >> "${VICIDIAL_STYLESHEET}.tmp"
|
|
tail -n +$((line_num + 1)) "$VICIDIAL_STYLESHEET" >> "${VICIDIAL_STYLESHEET}.tmp"
|
|
mv "${VICIDIAL_STYLESHEET}.tmp" "$VICIDIAL_STYLESHEET"
|
|
info "Añadido @import en vicidial_stylesheet.php"
|
|
}
|
|
|
|
install_admin_header_ref() {
|
|
if installed_admin_header; then
|
|
info "admin_header.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$ADMIN_HEADER" ]]; then
|
|
warn "No existe: $ADMIN_HEADER"
|
|
return 1
|
|
fi
|
|
save_pre_agc_backup "$ADMIN_HEADER"
|
|
local line_num
|
|
line_num=$(grep -n 'echo "</head>' "$ADMIN_HEADER" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { error "No se encontró echo \"</head>\" en admin_header.php"; return 1; }
|
|
local insert_line='echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../agc/css/custom.css\" />\n";'
|
|
head -n $((line_num - 1)) "$ADMIN_HEADER" > "${ADMIN_HEADER}.tmp"
|
|
echo "$insert_line" >> "${ADMIN_HEADER}.tmp"
|
|
tail -n +"$line_num" "$ADMIN_HEADER" >> "${ADMIN_HEADER}.tmp"
|
|
mv "${ADMIN_HEADER}.tmp" "$ADMIN_HEADER"
|
|
info "Añadido <link> en admin_header.php"
|
|
}
|
|
|
|
install_verm_ref() {
|
|
if installed_verm_ref; then
|
|
info "VERM_admin.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VERM_ADMIN_PHP" ]]; then
|
|
warn "No existe: $VERM_ADMIN_PHP (se omite VERM)."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$VERM_ADMIN_PHP"
|
|
local line_num
|
|
line_num=$(grep -n 'href="VERM_stylesheet.php"' "$VERM_ADMIN_PHP" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { warn "No se encontró VERM_stylesheet.php en VERM_admin.php"; return 1; }
|
|
local insert_line='<link rel="stylesheet" type="text/css" href="../agc/css/custom.css">'
|
|
head -n "$line_num" "$VERM_ADMIN_PHP" > "${VERM_ADMIN_PHP}.tmp"
|
|
echo "$insert_line" >> "${VERM_ADMIN_PHP}.tmp"
|
|
tail -n +$((line_num + 1)) "$VERM_ADMIN_PHP" >> "${VERM_ADMIN_PHP}.tmp"
|
|
mv "${VERM_ADMIN_PHP}.tmp" "$VERM_ADMIN_PHP"
|
|
info "Añadido <link> custom.css en VERM_admin.php"
|
|
}
|
|
|
|
install_verm_wallboard_ref() {
|
|
if installed_verm_wallboard_ref; then
|
|
info "VERM_wallboards.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VERM_WALLBOARDS_PHP" ]]; then
|
|
warn "No existe: $VERM_WALLBOARDS_PHP (se omite wallboard)."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$VERM_WALLBOARDS_PHP"
|
|
local line_num
|
|
line_num=$(grep -n 'href="VERM_wallboard_stylesheet.php"' "$VERM_WALLBOARDS_PHP" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { warn "No se encontró VERM_wallboard_stylesheet.php en VERM_wallboards.php"; return 1; }
|
|
local insert_line='<link rel="stylesheet" type="text/css" href="../agc/css/custom.css">'
|
|
head -n "$line_num" "$VERM_WALLBOARDS_PHP" > "${VERM_WALLBOARDS_PHP}.tmp"
|
|
echo "$insert_line" >> "${VERM_WALLBOARDS_PHP}.tmp"
|
|
tail -n +$((line_num + 1)) "$VERM_WALLBOARDS_PHP" >> "${VERM_WALLBOARDS_PHP}.tmp"
|
|
mv "${VERM_WALLBOARDS_PHP}.tmp" "$VERM_WALLBOARDS_PHP"
|
|
info "Añadido <link> custom.css en VERM_wallboards.php"
|
|
}
|
|
|
|
install_verm_custom_report_ref() {
|
|
if installed_verm_custom_report_ref; then
|
|
info "VERM_custom_report.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VERM_CUSTOM_REPORT_PHP" ]]; then
|
|
warn "No existe: $VERM_CUSTOM_REPORT_PHP (se omite custom report)."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$VERM_CUSTOM_REPORT_PHP"
|
|
local line_num
|
|
line_num=$(grep -n 'href="VERM_stylesheet.php"' "$VERM_CUSTOM_REPORT_PHP" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { warn "No se encontró VERM_stylesheet.php en VERM_custom_report.php"; return 1; }
|
|
local insert_line='<link rel="stylesheet" type="text/css" href="../agc/css/custom.css">'
|
|
head -n "$line_num" "$VERM_CUSTOM_REPORT_PHP" > "${VERM_CUSTOM_REPORT_PHP}.tmp"
|
|
echo "$insert_line" >> "${VERM_CUSTOM_REPORT_PHP}.tmp"
|
|
tail -n +$((line_num + 1)) "$VERM_CUSTOM_REPORT_PHP" >> "${VERM_CUSTOM_REPORT_PHP}.tmp"
|
|
mv "${VERM_CUSTOM_REPORT_PHP}.tmp" "$VERM_CUSTOM_REPORT_PHP"
|
|
info "Añadido <link> custom.css en VERM_custom_report.php"
|
|
}
|
|
|
|
install_verm_header_ref() {
|
|
if installed_verm_header_ref; then
|
|
info "VERM_header.inc: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VERM_HEADER_INC" ]]; then
|
|
warn "No existe: $VERM_HEADER_INC (se omite VERM main report page)."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$VERM_HEADER_INC"
|
|
local line_num
|
|
# VERM_header.inc usa comillas escapadas en PHP (\"); buscar solo el nombre del archivo
|
|
line_num=$(grep -n 'VERM_stylesheet\.php' "$VERM_HEADER_INC" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { warn "No se encontró VERM_stylesheet.php en VERM_header.inc"; return 1; }
|
|
local insert_line='$HTML_header.="<link rel=\"stylesheet\" type=\"text/css\" href=\"../agc/css/custom.css\">\n";'
|
|
head -n "$line_num" "$VERM_HEADER_INC" > "${VERM_HEADER_INC}.tmp"
|
|
echo "$insert_line" >> "${VERM_HEADER_INC}.tmp"
|
|
tail -n +$((line_num + 1)) "$VERM_HEADER_INC" >> "${VERM_HEADER_INC}.tmp"
|
|
mv "${VERM_HEADER_INC}.tmp" "$VERM_HEADER_INC"
|
|
info "Añadido <link> custom.css en VERM_header.inc (VERM_main_report_page.php)"
|
|
}
|
|
|
|
# --- Importación directa: realtime_report.php, welcome.php, hci_screen.php ---
|
|
install_realtime_report_ref() {
|
|
if installed_realtime_report_ref; then
|
|
info "realtime_report.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$REALTIME_REPORT_PHP" ]]; then
|
|
warn "No existe: $REALTIME_REPORT_PHP (se omite)."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$REALTIME_REPORT_PHP"
|
|
local line_num
|
|
line_num=$(grep -n 'META HTTP-EQUIV.*Content-Type.*charset=utf-8' "$REALTIME_REPORT_PHP" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { warn "No se encontró ancla META Content-Type en realtime_report.php"; return 1; }
|
|
local insert_line='echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../agc/css/custom.css\" />\n";'
|
|
head -n "$line_num" "$REALTIME_REPORT_PHP" > "${REALTIME_REPORT_PHP}.tmp"
|
|
echo "$insert_line" >> "${REALTIME_REPORT_PHP}.tmp"
|
|
tail -n +$((line_num + 1)) "$REALTIME_REPORT_PHP" >> "${REALTIME_REPORT_PHP}.tmp"
|
|
mv "${REALTIME_REPORT_PHP}.tmp" "$REALTIME_REPORT_PHP"
|
|
info "Añadido <link> custom.css en realtime_report.php"
|
|
}
|
|
|
|
install_welcome_ref() {
|
|
if installed_welcome_ref; then
|
|
info "welcome.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$WELCOME_PHP" ]]; then
|
|
warn "No existe: $WELCOME_PHP (se omite)."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$WELCOME_PHP"
|
|
local line_num
|
|
line_num=$(grep -n 'agc/css/style.css' "$WELCOME_PHP" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { warn "No se encontró style.css en welcome.php"; return 1; }
|
|
local insert_line='echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../agc/css/custom.css\" />\n";'
|
|
head -n "$line_num" "$WELCOME_PHP" > "${WELCOME_PHP}.tmp"
|
|
echo "$insert_line" >> "${WELCOME_PHP}.tmp"
|
|
tail -n +$((line_num + 1)) "$WELCOME_PHP" >> "${WELCOME_PHP}.tmp"
|
|
mv "${WELCOME_PHP}.tmp" "$WELCOME_PHP"
|
|
info "Añadido <link> custom.css en welcome.php"
|
|
}
|
|
|
|
install_hci_screen_ref() {
|
|
if installed_hci_screen_ref; then
|
|
info "hci_screen.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$HCI_SCREEN_PHP" ]]; then
|
|
warn "No existe: $HCI_SCREEN_PHP (se omite)."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$HCI_SCREEN_PHP"
|
|
local line_num
|
|
line_num=$(grep -n 'agc/css/style.css' "$HCI_SCREEN_PHP" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { warn "No se encontró style.css en hci_screen.php"; return 1; }
|
|
local insert_line=' <link rel="stylesheet" type="text/css" href="../agc/css/custom.css" />'
|
|
head -n "$line_num" "$HCI_SCREEN_PHP" > "${HCI_SCREEN_PHP}.tmp"
|
|
echo "$insert_line" >> "${HCI_SCREEN_PHP}.tmp"
|
|
tail -n +$((line_num + 1)) "$HCI_SCREEN_PHP" >> "${HCI_SCREEN_PHP}.tmp"
|
|
mv "${HCI_SCREEN_PHP}.tmp" "$HCI_SCREEN_PHP"
|
|
info "Añadido <link> custom.css en hci_screen.php"
|
|
}
|
|
|
|
install_vdc_script_notes_ref() {
|
|
if installed_vdc_script_notes_ref; then
|
|
info "vdc_script_notes.php: custom.css ya referenciado."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VDC_SCRIPT_NOTES_PHP" ]]; then
|
|
warn "No existe: $VDC_SCRIPT_NOTES_PHP (se omite iframe de notas)."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$VDC_SCRIPT_NOTES_PHP"
|
|
local line_num
|
|
line_num=$(grep -n 'href="calendar.css"' "$VDC_SCRIPT_NOTES_PHP" | head -1 | cut -d: -f1)
|
|
[[ -n "$line_num" ]] || { warn "No se encontró calendar.css en vdc_script_notes.php"; return 1; }
|
|
local insert_line='echo "<link rel=\"stylesheet\" href=\"css/custom.css\">\n";'
|
|
head -n "$line_num" "$VDC_SCRIPT_NOTES_PHP" > "${VDC_SCRIPT_NOTES_PHP}.tmp"
|
|
echo "$insert_line" >> "${VDC_SCRIPT_NOTES_PHP}.tmp"
|
|
tail -n +$((line_num + 1)) "$VDC_SCRIPT_NOTES_PHP" >> "${VDC_SCRIPT_NOTES_PHP}.tmp"
|
|
mv "${VDC_SCRIPT_NOTES_PHP}.tmp" "$VDC_SCRIPT_NOTES_PHP"
|
|
info "Añadido <link> custom.css en vdc_script_notes.php (iframe de notas)"
|
|
}
|
|
|
|
# --- Logo .gif en raíz vicidial (admin usa este cuando SSweb_logo=default_old) ---
|
|
install_logo_gif_vicidial_root() {
|
|
local logo_home="${INSTALADOR_DIR}/LogoHome.png"
|
|
local dest_gif="${VICIDIAL_DIR}/${LOGO_ADMIN_GIF_NAME}"
|
|
local backup_gif="${VICIDIAL_DIR}/vicidial_admin_web_logo${OLDCUSTOM_SUFFIX}.gif"
|
|
[[ -f "$logo_home" ]] || return 0
|
|
if [[ -f "$dest_gif" ]] && [[ ! -f "$backup_gif" ]]; then
|
|
cp -a "$dest_gif" "$backup_gif"
|
|
info "Backup logo .gif (original para desinstalar): $backup_gif"
|
|
fi
|
|
if command -v convert &>/dev/null; then
|
|
convert "$logo_home" "$dest_gif" && info "Logo .gif instalado: $dest_gif" || cp -a "$logo_home" "$dest_gif"
|
|
else
|
|
cp -a "$logo_home" "$dest_gif"
|
|
info "Logo .gif instalado: $dest_gif"
|
|
fi
|
|
}
|
|
|
|
restore_logo_gif_vicidial_root() {
|
|
local backup_gif="${VICIDIAL_DIR}/vicidial_admin_web_logo${OLDCUSTOM_SUFFIX}.gif"
|
|
local dest_gif="${VICIDIAL_DIR}/${LOGO_ADMIN_GIF_NAME}"
|
|
if [[ ! -f "$backup_gif" ]]; then return 1; fi
|
|
cp -a "$backup_gif" "$dest_gif"
|
|
rm -f "$backup_gif"
|
|
info "Restaurado logo .gif original: $dest_gif"
|
|
return 0
|
|
}
|
|
|
|
# --- Instalar logos: LogoHome Welcome, Admin y VERM; LogoAgent solo para agente (login + panel) ---
|
|
install_logos() {
|
|
local logo_home="${INSTALADOR_DIR}/LogoHome.png"
|
|
local logo_agent="${INSTALADOR_DIR}/LogoAgent.png"
|
|
# LogoHome → Welcome y Admin panel (vicidial/images + .gif)
|
|
install_logo_file "$logo_home" "$VICIDIAL_IMAGES" "$LOGO_WELCOME_NAME"
|
|
install_logo_gif_vicidial_root
|
|
# LogoHome → VERM (VERM_admin.php y páginas que incluyen admin_header desde /VERM/ usan VERM/images/)
|
|
if [[ -d "$VERM_IMAGES" ]]; then
|
|
install_logo_file "$logo_home" "$VERM_IMAGES" "$LOGO_WELCOME_NAME"
|
|
else
|
|
warn "No existe directorio $VERM_IMAGES (logo VERM no instalado)."
|
|
fi
|
|
# LogoAgent → solo agente: login (vicidial_admin_web_logo en agc) y panel (agc_agent_logo)
|
|
install_logo_file "$logo_agent" "$IMAGES_AGC" "$LOGO_AGENT_LOGIN_NAME"
|
|
install_logo_file "$logo_agent" "$IMAGES_AGC" "$LOGO_AGENT_PAGE_NAME"
|
|
}
|
|
|
|
# --- Desinstalar: quitar referencias CSS y restaurar logos desde *_OldCustom ---
|
|
uninstall_stylesheet_ref() {
|
|
if ! installed_stylesheet; then
|
|
info "vicidial_stylesheet.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if restore_from_pre_agc_backup "$VICIDIAL_STYLESHEET"; then
|
|
return 0
|
|
fi
|
|
warn "No hay backup .bak.pre_agc; quitando referencias con sed."
|
|
sed -i '/\/\* Importar estilos personalizados AGC \*\//d' "$VICIDIAL_STYLESHEET"
|
|
sed -i '/\/\* Importar estilos personalizados AGC (debe ir al inicio) \*\//d' "$VICIDIAL_STYLESHEET"
|
|
sed -i "/@import url('\.\.\/agc\/css\/custom\.css');/d" "$VICIDIAL_STYLESHEET"
|
|
sed -i '/@import url.*agc\/css\/custom\.css/d' "$VICIDIAL_STYLESHEET"
|
|
info "Referencias eliminadas en vicidial_stylesheet.php"
|
|
}
|
|
|
|
uninstall_admin_header_ref() {
|
|
if ! installed_admin_header; then
|
|
info "admin_header.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if restore_from_pre_agc_backup "$ADMIN_HEADER"; then
|
|
return 0
|
|
fi
|
|
warn "No hay backup .bak.pre_agc; quitando referencia con sed."
|
|
sed -i '/agc\/css\/custom\.css/d' "$ADMIN_HEADER"
|
|
info "Referencia eliminada en admin_header.php"
|
|
}
|
|
|
|
uninstall_verm_ref() {
|
|
if ! installed_verm_ref; then
|
|
info "VERM_admin.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VERM_ADMIN_PHP" ]]; then
|
|
return 0
|
|
fi
|
|
if restore_from_pre_agc_backup "$VERM_ADMIN_PHP"; then
|
|
return 0
|
|
fi
|
|
warn "No hay backup .bak.pre_agc; quitando referencia con sed."
|
|
sed -i '/agc\/css\/custom\.css/d' "$VERM_ADMIN_PHP"
|
|
info "Referencia eliminada en VERM_admin.php"
|
|
}
|
|
|
|
uninstall_verm_wallboard_ref() {
|
|
if ! installed_verm_wallboard_ref; then
|
|
info "VERM_wallboards.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VERM_WALLBOARDS_PHP" ]]; then
|
|
return 0
|
|
fi
|
|
if restore_from_pre_agc_backup "$VERM_WALLBOARDS_PHP"; then
|
|
return 0
|
|
fi
|
|
warn "No hay backup .bak.pre_agc; quitando referencia con sed."
|
|
sed -i '/agc\/css\/custom\.css/d' "$VERM_WALLBOARDS_PHP"
|
|
info "Referencia eliminada en VERM_wallboards.php"
|
|
}
|
|
|
|
uninstall_verm_custom_report_ref() {
|
|
if ! installed_verm_custom_report_ref; then
|
|
info "VERM_custom_report.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VERM_CUSTOM_REPORT_PHP" ]]; then
|
|
return 0
|
|
fi
|
|
if restore_from_pre_agc_backup "$VERM_CUSTOM_REPORT_PHP"; then
|
|
return 0
|
|
fi
|
|
warn "No hay backup .bak.pre_agc; quitando referencia con sed."
|
|
sed -i '/agc\/css\/custom\.css/d' "$VERM_CUSTOM_REPORT_PHP"
|
|
info "Referencia eliminada en VERM_custom_report.php"
|
|
}
|
|
|
|
uninstall_verm_header_ref() {
|
|
if ! installed_verm_header_ref; then
|
|
info "VERM_header.inc: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VERM_HEADER_INC" ]]; then
|
|
return 0
|
|
fi
|
|
if restore_from_pre_agc_backup "$VERM_HEADER_INC"; then
|
|
return 0
|
|
fi
|
|
warn "No hay backup .bak.pre_agc; quitando referencia con sed."
|
|
sed -i '/agc\/css\/custom\.css/d' "$VERM_HEADER_INC"
|
|
info "Referencia eliminada en VERM_header.inc"
|
|
}
|
|
|
|
uninstall_realtime_report_ref() {
|
|
if ! installed_realtime_report_ref; then
|
|
info "realtime_report.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$REALTIME_REPORT_PHP" ]]; then return 0; fi
|
|
if restore_from_pre_agc_backup "$REALTIME_REPORT_PHP"; then
|
|
return 0
|
|
fi
|
|
sed -i '/agc\/css\/custom\.css/d' "$REALTIME_REPORT_PHP"
|
|
info "Referencia eliminada en realtime_report.php"
|
|
}
|
|
|
|
uninstall_welcome_ref() {
|
|
if ! installed_welcome_ref; then
|
|
info "welcome.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$WELCOME_PHP" ]]; then return 0; fi
|
|
if restore_from_pre_agc_backup "$WELCOME_PHP"; then
|
|
return 0
|
|
fi
|
|
sed -i '/agc\/css\/custom\.css/d' "$WELCOME_PHP"
|
|
info "Referencia eliminada en welcome.php"
|
|
}
|
|
|
|
uninstall_hci_screen_ref() {
|
|
if ! installed_hci_screen_ref; then
|
|
info "hci_screen.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$HCI_SCREEN_PHP" ]]; then return 0; fi
|
|
if restore_from_pre_agc_backup "$HCI_SCREEN_PHP"; then
|
|
return 0
|
|
fi
|
|
sed -i '/agc\/css\/custom\.css/d' "$HCI_SCREEN_PHP"
|
|
info "Referencia eliminada en hci_screen.php"
|
|
}
|
|
|
|
uninstall_vdc_script_notes_ref() {
|
|
if ! installed_vdc_script_notes_ref; then
|
|
info "vdc_script_notes.php: no había referencia a custom.css."
|
|
return 0
|
|
fi
|
|
if [[ ! -f "$VDC_SCRIPT_NOTES_PHP" ]]; then return 0; fi
|
|
if restore_from_pre_agc_backup "$VDC_SCRIPT_NOTES_PHP"; then
|
|
return 0
|
|
fi
|
|
warn "No hay backup .bak.pre_agc; quitando referencia con sed."
|
|
sed -i '/css\/custom\.css/d' "$VDC_SCRIPT_NOTES_PHP"
|
|
info "Referencia eliminada en vdc_script_notes.php"
|
|
}
|
|
|
|
restore_logos() {
|
|
restore_logo_file "$VICIDIAL_IMAGES" "$LOGO_WELCOME_NAME" || true
|
|
restore_logo_gif_vicidial_root || true
|
|
restore_logo_file "$VERM_IMAGES" "$LOGO_WELCOME_NAME" || true
|
|
restore_logo_file "$IMAGES_AGC" "$LOGO_AGENT_LOGIN_NAME" || true
|
|
if restore_logo_file "$IMAGES_AGC" "$LOGO_AGENT_PAGE_NAME"; then
|
|
:
|
|
else
|
|
if [[ -f "${IMAGES_AGC}/${LOGO_AGENT_PAGE_NAME}" ]]; then
|
|
rm -f "${IMAGES_AGC}/${LOGO_AGENT_PAGE_NAME}"
|
|
info "Eliminado logo de agente (no existía original): ${IMAGES_AGC}/${LOGO_AGENT_PAGE_NAME}"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# --- Placeholders en vicidial.php (Phone Login size=10) ---
|
|
has_placeholders() {
|
|
[[ -f "$VICIDIAL_PHP" ]] && grep -q 'placeholder=.*_QXZ.*Phone Login' "$VICIDIAL_PHP"
|
|
}
|
|
|
|
install_placeholders() {
|
|
[[ -f "$VICIDIAL_PHP" ]] || { warn "vicidial.php no encontrado."; return 0; }
|
|
if has_placeholders; then
|
|
info "Placeholders Phone Login ya presentes en vicidial.php."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$VICIDIAL_PHP"
|
|
sed -i '/name=\\"phone_login\\" size=\\"10\\"/s/ value=\\"\\" \/>/ value=\\"\\" placeholder=\\""._QXZ("Phone Login")."\\" \/>/' "$VICIDIAL_PHP"
|
|
sed -i '/name=\\"phone_pass\\" size=\\"10\\"/s/ value=\\"\\" \/>/ value=\\"\\" placeholder=\\""._QXZ("Phone Password")."\\" \/>/' "$VICIDIAL_PHP"
|
|
info "Placeholders Phone Login añadidos en vicidial.php."
|
|
}
|
|
|
|
# --- Placeholders Re-Login (phone_login/phone_pass size=20) ---
|
|
has_relogin_placeholders() {
|
|
[[ -f "$VICIDIAL_PHP" ]] && grep -q 'phone_login.*size="20".*placeholder' "$VICIDIAL_PHP"
|
|
}
|
|
|
|
install_relogin_placeholders() {
|
|
[[ -f "$VICIDIAL_PHP" ]] || return 0
|
|
if has_relogin_placeholders; then
|
|
info "Placeholders Re-Login ya presentes."
|
|
return 0
|
|
fi
|
|
[[ -f "${VICIDIAL_PHP}${BACKUP_SUFFIX}" ]] || save_pre_agc_backup "$VICIDIAL_PHP"
|
|
sed -i '/name=\\"phone_login\\" size=\\"20\\"/s/ value=\\"\$phone_login\\" \/>/ value=\\"\$phone_login\\" placeholder=\\""._QXZ("Phone Login")."\\" \/>/' "$VICIDIAL_PHP"
|
|
sed -i '/name=\\"phone_pass\\" size=\\"20\\"/s/ value=\\"\$phone_pass\\" \/>/ value=\\"\$phone_pass\\" placeholder=\\""._QXZ("Phone Password")."\\" \/>/' "$VICIDIAL_PHP"
|
|
info "Placeholders Re-Login añadidos."
|
|
}
|
|
|
|
# --- Placeholders Campaign Login (VD_login/VD_pass) ---
|
|
has_campaign_placeholders() {
|
|
[[ -f "$VICIDIAL_PHP" ]] && grep -q 'VD_login.*placeholder.*User Login' "$VICIDIAL_PHP"
|
|
}
|
|
|
|
install_campaign_placeholders() {
|
|
[[ -f "$VICIDIAL_PHP" ]] || return 0
|
|
if has_campaign_placeholders; then
|
|
info "Placeholders Campaign Login ya presentes."
|
|
return 0
|
|
fi
|
|
[[ -f "${VICIDIAL_PHP}${BACKUP_SUFFIX}" ]] || save_pre_agc_backup "$VICIDIAL_PHP"
|
|
sed -i '/name=\\"VD_login\\" size=\\"20\\"/s/ value=\\"\$VD_login\\" \/>/ value=\\"\$VD_login\\" placeholder=\\""._QXZ("User Login")."\\" \/>/' "$VICIDIAL_PHP"
|
|
sed -i '/name=\\"VD_pass\\" size=\\"20\\"/s/ value=\\"\$VD_pass\\" \/>/ value=\\"\$VD_pass\\" placeholder=\\""._QXZ("User Password")."\\" \/>/' "$VICIDIAL_PHP"
|
|
info "Placeholders Campaign Login añadidos."
|
|
}
|
|
|
|
uninstall_placeholders() {
|
|
[[ -f "$VICIDIAL_PHP" ]] || return 0
|
|
if restore_from_pre_agc_backup "$VICIDIAL_PHP"; then
|
|
info "vicidial.php restaurado (placeholders quitados)."
|
|
return 0
|
|
fi
|
|
if ! has_placeholders && ! has_relogin_placeholders && ! has_campaign_placeholders; then
|
|
return 0
|
|
fi
|
|
sed -i 's/ placeholder=\\""._QXZ("Phone Login")."\\"//' "$VICIDIAL_PHP"
|
|
sed -i 's/ placeholder=\\""._QXZ("Phone Password")."\\"//' "$VICIDIAL_PHP"
|
|
sed -i 's/ placeholder=\\""._QXZ("User Login")."\\"//' "$VICIDIAL_PHP"
|
|
sed -i 's/ placeholder=\\""._QXZ("User Password")."\\"//' "$VICIDIAL_PHP"
|
|
info "Placeholders eliminados de vicidial.php."
|
|
}
|
|
|
|
# --- Placeholders en timeclock.php ---
|
|
has_timeclock_placeholders() {
|
|
[[ -f "$TIMECLOCK_PHP" ]] && grep -q 'placeholder=.*_QXZ.*User Login' "$TIMECLOCK_PHP"
|
|
}
|
|
|
|
install_timeclock_placeholders() {
|
|
[[ -f "$TIMECLOCK_PHP" ]] || { warn "timeclock.php no encontrado."; return 0; }
|
|
if has_timeclock_placeholders; then
|
|
info "Placeholders ya presentes en timeclock.php."
|
|
return 0
|
|
fi
|
|
save_pre_agc_backup "$TIMECLOCK_PHP"
|
|
sed -i '/NAME=user SIZE=10 MAXLENGTH=20/s/VALUE=\\"\$VD_login\\">/VALUE=\\"$VD_login\\" placeholder=\\""._QXZ("User Login")."\\">/' "$TIMECLOCK_PHP"
|
|
sed -i '/NAME=pass SIZE=10 MAXLENGTH=20/s/VALUE='"'"''"'"'>/VALUE='"'"''"'"' placeholder=\\""._QXZ("User Password")."\\">/' "$TIMECLOCK_PHP"
|
|
info "Placeholders añadidos en timeclock.php."
|
|
}
|
|
|
|
uninstall_timeclock_placeholders() {
|
|
[[ -f "$TIMECLOCK_PHP" ]] || return 0
|
|
if restore_from_pre_agc_backup "$TIMECLOCK_PHP"; then
|
|
info "timeclock.php restaurado."
|
|
return 0
|
|
fi
|
|
if ! has_timeclock_placeholders; then return 0; fi
|
|
sed -i 's/ placeholder=\\""._QXZ("User Login")."\\"//' "$TIMECLOCK_PHP"
|
|
sed -i 's/ placeholder=\\""._QXZ("User Password")."\\"//' "$TIMECLOCK_PHP"
|
|
info "Placeholders eliminados de timeclock.php."
|
|
}
|
|
|
|
# --- Dejar custom.css en blanco con solo comentario "Custom desinstalado" ---
|
|
write_custom_css_uninstalled() {
|
|
printf '/* Custom desinstalado */\n' > "$CUSTOM_CSS_DEST"
|
|
info "custom.css dejado en blanco (comentario: Custom desinstalado)."
|
|
}
|
|
|
|
do_install() {
|
|
echo "=== Instalador AGC (custom.css + logos + placeholders) ==="
|
|
info "Raíz: $HTDOCS"
|
|
info "Instalador: $INSTALADOR_DIR"
|
|
copy_custom_css
|
|
install_logos
|
|
install_stylesheet_ref
|
|
install_admin_header_ref
|
|
install_verm_ref
|
|
install_verm_header_ref
|
|
install_verm_wallboard_ref
|
|
install_verm_custom_report_ref
|
|
install_realtime_report_ref
|
|
install_welcome_ref
|
|
install_hci_screen_ref
|
|
install_vdc_script_notes_ref
|
|
install_placeholders
|
|
install_relogin_placeholders
|
|
install_campaign_placeholders
|
|
install_timeclock_placeholders
|
|
echo ""
|
|
info "Instalación completada. Si custom.css ya existía, se guardó en ${CUSTOM_CSS_DEST}${BACKUP_SUFFIX}"
|
|
}
|
|
|
|
do_uninstall() {
|
|
echo "=== Desinstalación AGC (restaurar referencias, logos, placeholders y custom.css) ==="
|
|
info "Raíz: $HTDOCS"
|
|
uninstall_stylesheet_ref
|
|
uninstall_admin_header_ref
|
|
uninstall_verm_ref
|
|
uninstall_verm_header_ref
|
|
uninstall_verm_wallboard_ref
|
|
uninstall_verm_custom_report_ref
|
|
uninstall_realtime_report_ref
|
|
uninstall_welcome_ref
|
|
uninstall_hci_screen_ref
|
|
uninstall_vdc_script_notes_ref
|
|
uninstall_placeholders
|
|
uninstall_timeclock_placeholders
|
|
restore_logos
|
|
write_custom_css_uninstalled
|
|
echo ""
|
|
info "Desinstalación completada."
|
|
}
|
|
|
|
do_status() {
|
|
echo "=== Estado instalador AGC ==="
|
|
info "Raíz: $HTDOCS"
|
|
info "Instalador: $INSTALADOR_DIR"
|
|
[[ -f "$CUSTOM_CSS_SOURCE" ]] && info "custom.css en instalador: presente" || warn "custom.css en instalador: no encontrado"
|
|
[[ -f "${INSTALADOR_DIR}/LogoHome.png" ]] && info "LogoHome.png: presente" || warn "LogoHome.png: no encontrado"
|
|
[[ -f "${INSTALADOR_DIR}/LogoAgent.png" ]] && info "LogoAgent.png: presente" || warn "LogoAgent.png: no encontrado"
|
|
if [[ -f "$CUSTOM_CSS_DEST" ]]; then info "custom.css instalado: $CUSTOM_CSS_DEST"; else warn "custom.css instalado: no"; fi
|
|
if [[ -f "${CUSTOM_CSS_DEST}${BACKUP_SUFFIX}" ]]; then info "Backup custom.css: ${CUSTOM_CSS_DEST}${BACKUP_SUFFIX}"; fi
|
|
if [[ -f "$VICIDIAL_STYLESHEET" ]]; then
|
|
installed_stylesheet && info "vicidial_stylesheet.php: referenciado" || warn "vicidial_stylesheet.php: no referenciado"
|
|
fi
|
|
if [[ -f "$ADMIN_HEADER" ]]; then
|
|
installed_admin_header && info "admin_header.php: referenciado" || warn "admin_header.php: no referenciado"
|
|
fi
|
|
if [[ -f "$VERM_ADMIN_PHP" ]]; then
|
|
installed_verm_ref && info "VERM_admin.php: referenciado" || warn "VERM_admin.php: no referenciado"
|
|
fi
|
|
if [[ -f "$VERM_HEADER_INC" ]]; then
|
|
installed_verm_header_ref && info "VERM_header.inc (VERM_main_report_page): referenciado" || warn "VERM_header.inc: no referenciado"
|
|
fi
|
|
if [[ -f "$VERM_WALLBOARDS_PHP" ]]; then
|
|
installed_verm_wallboard_ref && info "VERM_wallboards.php: referenciado" || warn "VERM_wallboards.php: no referenciado"
|
|
fi
|
|
if [[ -f "$VERM_CUSTOM_REPORT_PHP" ]]; then
|
|
installed_verm_custom_report_ref && info "VERM_custom_report.php: referenciado" || warn "VERM_custom_report.php: no referenciado"
|
|
fi
|
|
if [[ -f "$REALTIME_REPORT_PHP" ]]; then
|
|
installed_realtime_report_ref && info "realtime_report.php: referenciado" || warn "realtime_report.php: no referenciado"
|
|
fi
|
|
if [[ -f "$WELCOME_PHP" ]]; then
|
|
installed_welcome_ref && info "welcome.php: referenciado" || warn "welcome.php: no referenciado"
|
|
fi
|
|
if [[ -f "$HCI_SCREEN_PHP" ]]; then
|
|
installed_hci_screen_ref && info "hci_screen.php: referenciado" || warn "hci_screen.php: no referenciado"
|
|
fi
|
|
if [[ -f "$VDC_SCRIPT_NOTES_PHP" ]]; then
|
|
installed_vdc_script_notes_ref && info "vdc_script_notes.php (iframe notas): referenciado" || warn "vdc_script_notes.php: no referenciado"
|
|
fi
|
|
if [[ -f "$VICIDIAL_PHP" ]]; then
|
|
has_placeholders && info "vicidial.php: placeholders Phone (size=10) presentes" || warn "vicidial.php: placeholders Phone no presentes"
|
|
has_relogin_placeholders && info "vicidial.php: placeholders Re-Login presentes" || warn "vicidial.php: placeholders Re-Login no presentes"
|
|
has_campaign_placeholders && info "vicidial.php: placeholders Campaign Login presentes" || warn "vicidial.php: placeholders Campaign no presentes"
|
|
fi
|
|
if [[ -f "$TIMECLOCK_PHP" ]]; then
|
|
has_timeclock_placeholders && info "timeclock.php: placeholders presentes" || warn "timeclock.php: placeholders no presentes"
|
|
fi
|
|
for dir in "$VICIDIAL_IMAGES" "$VERM_IMAGES" "$IMAGES_AGC"; do
|
|
[[ -d "$dir" ]] || continue
|
|
for name in "$LOGO_WELCOME_NAME" "$LOGO_AGENT_LOGIN_NAME" "$LOGO_AGENT_PAGE_NAME"; do
|
|
base="${name%.*}"
|
|
ext="${name##*.}"
|
|
if [[ -f "${dir}/${base}${OLDCUSTOM_SUFFIX}.${ext}" ]]; then
|
|
info "Backup logo: ${dir}/${base}${OLDCUSTOM_SUFFIX}.${ext}"
|
|
fi
|
|
done
|
|
done
|
|
}
|
|
|
|
ACTION="${1:-install}"
|
|
case "$ACTION" in
|
|
install) do_install ;;
|
|
uninstall) do_uninstall ;;
|
|
status) do_status ;;
|
|
*)
|
|
echo "Uso: $0 { install | uninstall | status }"
|
|
echo " Ruta absoluta: /srv/www/htdocs/agc/css/installer/install_custom_css.sh"
|
|
echo " install - Copia custom.css, instala logos y referencias CSS (vicidial, admin, VERM admin/main report/wallboard/custom report)."
|
|
echo " uninstall - Restaura referencias y logos desde backup (no restaura custom.css)."
|
|
echo " status - Estado de archivos y referencias."
|
|
echo ""
|
|
echo "Contenido de installer/: custom.css, LogoHome.png, LogoAgent.png, este script."
|
|
echo "Para otro ViciDial: HTDOCS=/ruta/htdocs /srv/www/htdocs/agc/css/installer/install_custom_css.sh install"
|
|
exit 1
|
|
;;
|
|
esac
|