🤖 AI Content Assistant — Joomla Component

AI Content Assistant is a professional Joomla 5.x component for automated content generation using multiple AI providers. It allows you to create articles, blog posts, tutorials, and marketing copy with full control over style and structure.

✨ Key Features

  • Content Types: Articles, Blogs, Reviews, Guides, News
  • Writing Tones: Professional, Friendly, Casual, Informative
  • AI Providers: OpenAI (GPT), Anthropic (Claude), Google (Gemini)
  • Content Rules: Custom writing templates and structure
  • Layout Templates: Control image placement and typography
  • Statistics: Track total, daily, and monthly generation
  • History: Manage and edit generated content

📥 Download
To install the latest version of AI Content Assistant, download the ZIP package and upload it via Joomla Extension Manager.
[AI CONTENT ASSISTANT - latest version]

ℹ️ Version Info

### Version 3.0.0 (Major Release) - The Custom Builder Update

- **NEW: Interactive Custom Layout Builder (Template 6)**
  - A fully interactive, element-based layout builder replaces the old Template 6.
  - Users can now create unique article structures by adding and arranging various content blocks.
  - Live preview updates in real-time as the layout is being built.
  - Supported elements include:
  - **AI Text:** Placeholders for the main AI-generated content.
  - **Photos (1, 2, 3):** Embed images from the Global Photo Gallery.
  - **Video Embed:** Easily embed YouTube or Vimeo videos by pasting a URL.
  - **iFrame Embed:** Embed content from external sites like Google Maps, forms, etc.
  - **Custom Text:** Insert custom-written paragraphs or basic HTML.
  - All custom layouts are saved per-profile.

- **NEW: Universal Photo Linking**
  - Added an optional "Link URL" field to each of the 3 slots in the Global Photo Gallery.
  - Any photo used in Templates 2 through 6 can now be hyperlinked, making images more interactive.
  - The link is saved globally with the photo, independent of any profile.

- **ENHANCED: User Interface**
  - Redesigned the "Layout Templates" tab to be more intuitive, separating the Global Photo Gallery from the Template      Selection.
  - Added a dedicated workspace for the new Custom Builder, which appears when Template 6 is selected.

- **REFACTORED: Template System**
  - Removed the old Template 5 (Vertical Stack) to make room for the superior Custom Builder. The old Template 6 (Magazine Style) is now Template 5.
  - Backend logic in `ContentGeneratorModel` was completely refactored to support the new element-based structure from the Custom Builder.

- **IMPROVED: Profile Management**
  - JavaScript logic for saving and loading profiles has been updated to handle the new `customBuilderElements` array and universal photo links.

- **UPDATED: Documentation**
  - The internal "Ustav" has been updated to reflect the new architecture and functionalities.

## [2.5.0] - 2025-10-07

### 🎉 Major Features & Enhancements
- **ADDED: Advanced Content Rules** - New features added to the "Content Rules" tab to provide granular control over AI generation.
  - **Article Headings (PRO):** Define a specific structure of H2/H3 headings for the AI to follow.
  - **Writing Guidelines (PRO):** Provide detailed stylistic instructions, keywords to use, and tone of voice.
  - **Web Sources (PREMIUM):** Input up to 5 URLs for the AI to use as research material for content generation.
  - **Structure Name:** Name and save your content rule structures for easy identification.

### 🐛 Critical Bug Fixes & Improvements
- **FIXED: Joomla "Global Check-in" Problem** - Completely resolved the issue where generated articles would remain locked. The system now uses the official `JTable::checkIn()` method, ensuring articles are always available for editing immediately after creation. This eliminates the need for any manual administrative action.
- **FIXED: "Field 'images' doesn't have a default value" Error** - Corrected a critical bug that prevented article creation by ensuring all necessary database fields are properly initialized.
- **IMPROVED: License & Feature Unlocking** - Completely refactored the JavaScript architecture for handling feature access.
  - **Centralized Logic:** All license-related logic is now handled by a central coordinator (`dashboard.js`), eliminating "race conditions" and unpredictable behavior.
  - **Removed Obsolete Code:** All old `event listener` based code and fallback mechanisms have been removed from `header.js` and `content-rules.js`, resulting in a cleaner and more reliable system.
- **FIXED: JavaScript ReferenceError on Load** - Resolved the `Uncaught ReferenceError: headerLockFreeFields is not defined` error by removing obsolete function exports.

### 🔧 Technical & Architectural Changes
- **REFACTORED:** `ContentGeneratorModel.php` - Implemented the official Joomla `checkIn` method for robust article unlocking.
- **REFACTORED:** `header.js`, `dashboard.js`, `content-rules.js` - Overhauled the entire feature-locking mechanism to be centralized and synchronous.
- **CLEANED:** Removed a significant amount of legacy and redundant JavaScript code related to the old licensing system.

---

## [2.4.0] - 2025-10-06

### 🎉 Major Features & Enhancements

#### ⏰ Zero-Configuration Scheduler (PRO Feature)
- **ADDED: Pseudo-Cron Scheduling System** - Schedule articles for future publication without any server-side cron setup. The scheduler automatically processes pending articles using user activity as a trigger (checks every 5 minutes).
- **ADDED: Auto-Refresh Schedule List** - Schedule list automatically refreshes every 30 seconds, keeping users informed of pending and completed schedules in real-time.
- **FIXED: Scheduler API Integration** - Resolved critical issue where frontend `saveSchedule` calls were not properly mapped to backend `scheduleArticle` endpoint.
- **FIXED: POST Data Handling** - Backend now correctly reads schedule data from POST parameters instead of expecting JSON body format.
- **ENHANCED: Topic Preservation** - Schedule system now properly preserves article topics through the entire generation pipeline (frontend → API → SchedulerService → ContentGenerator).

#### 🔓 Automatic Check-in System
- **ADDED: Triple-Layer Check-in Protection** - Articles are now automatically unlocked after creation using a three-step safety mechanism:
  1. Pre-insert: `checked_out = 0` is set before database insertion
  2. Post-insert: Forced UPDATE query to ensure unlock
  3. Verification: Status check confirms article is unlocked
- **FIXED: Locked Articles Bug** - Resolved longstanding issue where generated articles remained locked in Joomla Article Manager, requiring manual check-in.

#### 🐛 Critical Bug Fixes
- **FIXED: Empty Schedule Data** - Resolved issue where `$input->json->getArray()` returned empty array for POST form data
- **FIXED: Topic Loss in Scheduler** - Complete data flow audit and fix ensuring topic travels correctly from `extras.js` → `ApiController` → `SchedulerService` → `processSchedule` → `generateContent`
- **ADDED: Comprehensive Debug Logging** - Detailed logging added to track data flow through scheduler pipeline (stored in `/administrator/logs/scheduler_debug.log`)

### ✨ Improvements
- **ENHANCED: Schedule Data Architecture** - Scheduler now correctly loads complete profile data and merges it with schedule-specific settings
- **IMPROVED: Timezone Handling** - All scheduled dates properly converted between user timezone and UTC for database storage
- **OPTIMIZED: Frontend Console Logging** - Cleaner, more informative console output for scheduler operations

### 🔧 Technical Changes
- **Updated:** `dashboard.js` - Added scheduler API endpoint mappings (`saveSchedule`, `getSchedules`, `deleteSchedule`)
- **Updated:** `ApiController.php` v2.3.7 - Fixed POST data reading for scheduler endpoints
- **Updated:** `ContentGeneratorModel.php` v2.3.6 - Enhanced check-in logic with verification
- **Updated:** `SchedulerService.php` v2.4.0 - Improved topic extraction and profile data merging
- **Updated:** `extras.js` v2.3.7 - Added auto-refresh interval and global function export

---

## [2.3.0] - PLANNED RELEASE DATE

### 🎉 Major Features & Fixes
- **FIXED: Critical Image Integration Bug** - Complete overhaul of the photo integration logic. Images are now correctly cleaned, processed, and inserted into the final article content using robust string replacement instead of DOMDocument, solving the longstanding issue of images not appearing.
- **FIXED: Empty Articles Bug** - Resolved a critical bug where articles were created with no content. The issue was traced to an undefined variable being passed during article creation. The system now correctly uses the final, processed `$content` variable.
- **REFINED: AI Content Cleaning** - Implemented a mandatory cleaning step for all content returned by AI providers. This removes unwanted HTML wrappers (`<!DOCTYPE>`, `<html>`, `<body>`), markdown code blocks, and other extraneous tags before content is processed, ensuring stability.
- **IMPROVED: Backend Architecture for Photos** - Photos are now loaded directly from the database on the backend (`#__user_profiles`) instead of being passed through POST requests. This bypasses Joomla's security filters that were stripping complex array data, ensuring photos are always available for integration.
- **ADDED: Production-Ready Code** - All temporary debugging `error_log()` calls have been removed from the codebase, making the component clean, secure, and ready for the Joomla Extensions Directory (JED).
- **UPDATED: Documentation & Versioning** - The internal "Ustav" document has been significantly updated with learned lessons, new architectural rules, and debugging best practices. All relevant files have been version-bumped to 2.3.0.

---

## [2.0.0] - 2025-01-27

### 🎉 Major Features Added
- **🎫 Free/Pro/Premium Licensing System** - Complete version control with license key validation
- **📸 Photo Integration** - Upload and integrate photos into generated content
- **🎨 Enhanced Layout Templates** - 9 professional templates with photo positioning
- **🔒 Version-Based Feature Control** - Visual and functional restrictions based on license level
- **📱 Template Position System** - Green, Blue, Orange photo placement options

### ✨ New Features
- **License Key Validation** - Simple license key system (PRO-123, PREMIUM-456)
- **Photo Upload System** - 6 photo slots with drag-and-drop functionality
- **Template Selection** - Choose from 9 professional content templates
- **Version Badges** - Visual indicators for FREE/PRO/PREMIUM features
- **Profile System Enhancement** - 6 profiles with version-based access control
- **Extras Tab Features** - Schedule Publishing, Bulk Generation, Advanced Themes

### 🔧 Improvements
- **JED Checker Compliance** - All Joomla Extension Directory requirements met
- **Joomla 5 Compatibility** - Updated for latest Joomla framework
- **Enhanced Security** - Local API key storage, no external data collection
- **Better UI/UX** - Improved visual feedback and user experience
- **Performance Optimization** - Faster loading and better resource management

### 🐛 Bug Fixes
- **Photo Upload Issues** - Fixed recursion and file dialog problems
- **Version Control Logic** - Corrected field locking/unlocking system
- **Template Selection** - Fixed template preview and selection functionality
- **JavaScript Errors** - Resolved all console errors and warnings
- **CSS Compatibility** - Fixed dark mode and responsive design issues

### 🔒 Security & Privacy
- **Local API Storage** - API keys stored only in local Joomla database
- **No Data Collection** - Component does not transmit user data externally
- **GDPR Compliance** - Privacy regulation compliant
- **Content Ownership** - Users retain full rights to generated content

---

## [1.2.0] - 2025-07-23

### 🎉 Major Features Added
- **📝 Content Rules System** - Create custom writing rules and content structure templates
- **🎨 Layout Templates Tab** - Separated physical layout from content rules
- **🆓 Freemium Model** - Free version with 1 content rule limit, Pro upgrade available
- **🧪 Rule Testing** - Test your content rules with demo generation
- **💾 Local Storage** - Content rules saved persistently in browser

### ✨ New Features
- **5-Tab Interface** - Generate Content, Extras, Layout Templates, Content Rules, History
- **Rule Management** - Create, edit, delete, and preview custom content rules
- **Rule Categories** - Predefined examples: Sport Articles, Recipe Posts, Tech Reviews, Marketing Copy
- **Test Generation** - Preview how your rules will affect content generation
- **Usage Tracking** - Track how many times each rule has been used
- **Pro Version Hooks** - Infrastructure ready for premium features

### 🔧 Improvements
- **Better Footer Attribution** - Links to technodrome.nasrpskom.com with proper branding
- **Enhanced UI/UX** - Improved tab navigation and visual hierarchy
- **Free Version Limitations** - Clear messaging about Pro upgrade benefits
- **Component Versioning** - Proper version display in header (v1.2.0)

### 🐛 Bug Fixes
- **Date Format** - Fixed creation date format in XML manifest
- **JavaScript Optimization** - Cleaner code without syntax errors
- **Template Structure** - Separated concerns between layout and content rules

---

## [1.1.0] - 2025-07-22

### 🚀 Major Features Added
- **🤖 Multiple AI Providers** - OpenAI (GPT), Anthropic (Claude), Google (Gemini)
- **💬 Conversation Contexts** - Predefined writing styles and contexts
- **🔑 API Integration** - Full Claude API integration with proper error handling
- **⚙️ Dynamic Model Selection** - Models change based on selected AI provider

### ✨ New Features
- **Provider-Specific Models** - Each AI provider shows relevant models only
- **API Key Management** - Secure API key input with connection status
- **Conversation Templates** - Recipe Rules, Blog Style, Technical Docs, Marketing Copy
- **Enhanced AI Settings Panel** - Right-side panel with provider info and links
- **API Status Indicator** - Real-time connection status with color coding

### 🔧 Improvements
- **Better Error Handling** - Comprehensive API error messages and fallbacks
- **Enhanced UI** - Dynamic hiding/showing of API fields based on provider
- **Direct API Links** - Quick access to get API keys from provider websites
- **Fallback System** - Automatic fallback to demo mode if API fails

---

## [1.0.1] - 2025-07-22

### 🎉 Core Functionality Completed
- **✅ Title Generation Fixed** - Simple title generation without prefixes
- **✅ Publish Toggle Working** - Articles respect publish/unpublish setting
- **✅ Delete Functionality** - Proper trash workflow integration

### ✨ New Features
- **🗑️ Article Management** - Move articles to trash from History tab
- **📊 Statistics Display** - Total, today, and monthly article counts
- **🎭 Enhanced Demo Mode** - Better content templates and generation
- **💾 Better Data Handling** - Improved article creation and state management

### 🔧 Improvements
- **Clean Title Generation** - "hello" becomes "Hello" (not "Understanding Hello...")
- **Publish State Respect** - OFF toggle creates unpublished articles
- **Trash Integration** - Delete button moves articles to Joomla trash properly
- **History Filtering** - Trashed articles don't appear in History tab
- **User Feedback** - Clear success/error messages for all operations

### 🐛 Major Bug Fixes
- **Fixed Title Prefixes** - Removed automatic "Understanding" prefix
- **Fixed Publish Toggle** - Now properly respects ON/OFF state
- **Fixed Delete Function** - Uses proper Joomla trash workflow
- **Fixed History Display** - Excludes trashed articles (state != -2)
- **Enhanced Error Handling** - Better JSON parsing and error messages

---

## [1.0.0] - 2025-07-22

### 🎉 Initial Release
- **🤖 AI Content Generation** - Demo mode content generation
- **📝 Content Management** - Create articles with various types and tones
- **🎭 Multiple Content Types** - Article, Blog Post, Tutorial, Review, Guide, News
- **💼 Writing Tones** - Professional, Friendly, Casual, Formal, Enthusiastic, Informative
- **📏 Word Count Options** - 300, 500, 800, 1200 words
- **📁 Category Integration** - Full Joomla category hierarchy support
- **📊 Dashboard Interface** - Modern tabbed interface with statistics
- **🔧 Settings Panel** - AI provider selection (demo mode)
- **📈 History Tracking** - Recent content generation history
- **✏️ Article Integration** - Direct links to edit generated articles

### 🏗️ Architecture
- **MVC Structure** - Proper Joomla component architecture
- **GPL Licensed** - Open source with proper GPL headers
- **Joomla 5 Compatible** - Full Joomla 5.x compatibility
- **Responsive Design** - Modern, mobile-friendly interface
- **Database Integration** - Proper Joomla database handling
- **User Permissions** - Respects Joomla user authorization

### 🎨 User Interface
- **Modern Design** - Clean, professional interface with gradients
- **Tabbed Navigation** - Generate Content, Extras, Templates, History
- **Statistics Dashboard** - Article count tracking
- **Settings Panel** - AI provider configuration
- **Footer Statistics** - Quick access to generation stats
- **Responsive Layout** - Works on all device sizes

---

## Upgrade Notes

### From 1.1.0 to 1.2.0
- **New Content Rules feature** - Create custom writing templates
- **Tab restructure** - Templates split into Layout Templates and Content Rules
- **Local storage** - Rules saved in browser (upgrade to Pro for cloud sync)
- **Freemium model** - Free version limited to 1 content rule

### From 1.0.1 to 1.1.0
- **API integration** - Add your API keys for real AI generation
- **Multiple providers** - Choose between OpenAI, Anthropic, or Google
- **Enhanced settings** - More configuration options available

### From 1.0.0 to 1.0.1
- **Core fixes** - All major functionality now working properly
- **Delete workflow** - Articles properly moved to trash
- **Publish control** - Toggle now affects article publish state

---

## Support & Documentation

- **Documentation**: Available in component README.md
- **Support**: https://technodrome.nasrpskom.com
- **Issues**: Report via GitHub or support channels
- **Pro Version**: Enhanced features and unlimited content rules

---

*Generated with ❤️ by Technodrome*