Skip to content

Commit

Permalink
Merge pull request #966 from Joomla-Bible-Study/admin_mod_proclaim
Browse files Browse the repository at this point in the history
New mod_proclaimicon for Admin View.
  • Loading branch information
bcordis authored Nov 26, 2024
2 parents cdaa983 + 883010d commit e625973
Show file tree
Hide file tree
Showing 22 changed files with 809 additions and 89 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ build/reports/project-size.txt
/media/css/site/cwmcore.css
/admin/proclaim.script.php
!/.php_cs.cache
/build.properties
1 change: 0 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@

## Reporting a Vulnerability

Info coming soon.
8 changes: 7 additions & 1 deletion admin/language/en-GB/en-GB.com_proclaim.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; Copyright (c) 2008 CWM Team
; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 - No BOM
; Used only for Post Install Language Translations.
; Used only for com_proclaim.
COM_PROCLAIM = "CWM-Proclaim"

; Simple Mode message
Expand All @@ -18,6 +18,12 @@ COM_PROCLAIM_N_ITEMS_PUBLISHED = "%d item(s) published"
COM_PROCLAIM_N_ITEMS_TRASHED = "%d Item(s) Trashed"
COM_PROCLAIM_N_ITEMS_UNPUBLISHED = "%d items(s) unpublished"
COM_PROCLAIM_N_ITEMS_CHECKED_IN = "%d items(s) checked in"
COM_PROCLAIM_N_QUICKICON_MESSAGES_SRONLY="Proclaim: %d Messages are available."
COM_PROCLAIM_N_QUICKICON_MESSAGES="Messages"
COM_PROCLAIM_N_QUICKICON_MEDIAFILES_SRONLY="Proclaim: %d Media Files are available."
COM_PROCLAIM_N_QUICKICON_MEDIAFILES="Media Files"
COM_PROCLAIM_N_QUICKICON_SERIES_SRONLY="Proclaim: %d Series are available."
COM_PROCLAIM_N_QUICKICON_SERIES="Series"

;; Content Articles
COM_CONTENT_CHANGE_ARTICLE = "Select or Change article"
Expand Down
4 changes: 2 additions & 2 deletions admin/language/en-GB/en-GB.com_proclaim.sys.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; $Id: en-GB.COM_PROCLAIM.sys.ini 2025 2011-08-28 04:08:06Z genu $
; Copyright (c) 2008 Tom Fuller
; $Id: en-GB.com_proclaim.sys.ini 2025 2011-08-28 04:08:06Z genu $
; Copyright (c) 2008 CWM Team
; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
; Note : All ini files need to be saved as UTF-8 - No BOM

Expand Down
27 changes: 27 additions & 0 deletions admin/src/Controller/CwmmediafilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

use CWM\Component\Proclaim\Administrator\Model\CwmmediafileModel;
use CWM\Component\Proclaim\Administrator\Model\CwmmediafilesModel;
use CWM\Component\Proclaim\Administrator\Model\CwmmessagesModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\Utilities\ArrayHelper;
Expand Down Expand Up @@ -121,4 +123,29 @@ public function getModel($name = 'Cwmmediafile', $prefix = 'Administrator', $con
{
return parent::getModel($name, $prefix, $config);
}

/**
* Method to get the JSON-encoded number of published Media Files
*
* @return void
*
* @since 10.0.0
*/
public function getQuickIconMediaFiles(): void
{
/** @var CwmmediafilesModel $model */
$model = $this->getModel('cwmmediafiles');

$model->setState('filter.published', 1);

$amount = (int) $model->getTotal();

$result = [];

$result['amount'] = $amount;
$result['sronly'] = Text::plural('COM_PROCLAIM_N_QUICKICON_MEDIAFILES_SRONLY', $amount);
$result['name'] = Text::plural('COM_PROCLAIM_N_QUICKICON_MEDIAFILES', $amount);

echo new JsonResponse($result);
}
}
28 changes: 28 additions & 0 deletions admin/src/Controller/CwmmessagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@

// phpcs:enable PSR1.Files.SideEffects

use CWM\Component\Proclaim\Administrator\Model\CwmmessagesModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\Utilities\ArrayHelper;

/**
Expand Down Expand Up @@ -74,4 +77,29 @@ public function getModel($name = 'Cwmmessage', $prefix = 'Administrator', $confi
{
return parent::getModel($name, $prefix, $config);
}

/**
* Method to get the JSON-encoded number of published Messages
*
* @return void
*
* @since 10.0.0
*/
public function getQuickIconMessage(): void
{
/** @var CwmmessagesModel $model */
$model = $this->getModel('cwmmessages');

$model->setState('filter.published', 1);

$amount = (int) $model->getTotal();

$result = [];

$result['amount'] = $amount;
$result['sronly'] = Text::plural('COM_PROCLAIM_N_QUICKICON_MESSAGES_SRONLY', $amount);
$result['name'] = Text::plural('COM_PROCLAIM_N_QUICKICON_MESSAGES', $amount);

echo new JsonResponse($result);
}
}
28 changes: 28 additions & 0 deletions admin/src/Controller/CwmseriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@

// phpcs:enable PSR1.Files.SideEffects

use CWM\Component\Proclaim\Administrator\Model\CwmseriesModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\Utilities\ArrayHelper;

/**
Expand Down Expand Up @@ -74,4 +77,29 @@ public function getModel($name = 'Cwmserie', $prefix = 'Administrator', $config
{
return parent::getModel($name, $prefix, $config);
}

/**
* Method to get the JSON-encoded number of published Series
*
* @return void
*
* @since 10.0.0
*/
public function getQuickIconSeries(): void
{
/** @var CwmseriesModel $model */
$model = $this->getModel('cwmseries');

$model->setState('filter.published', 1);

$amount = (int) $model->getTotal();

$result = [];

$result['amount'] = $amount;
$result['sronly'] = Text::plural('COM_PROCLAIM_N_QUICKICON_SERIES_SRONLY', $amount);
$result['name'] = Text::plural('COM_PROCLAIM_N_QUICKICON_SERIES', $amount);

echo new JsonResponse($result);
}
}
8 changes: 5 additions & 3 deletions admin/src/Helper/Cwmparams.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

// phpcs:enable PSR1.Files.SideEffects

use http\Exception\RuntimeException;
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
use PHPUnit\Runner\Exception;

/**
* This is for Retrieving Admin and Template db
Expand Down Expand Up @@ -50,7 +52,7 @@ class Cwmparams
*/
public static object $templateTable;

/** @var int Default template id and used to check if changed form from last query
/** @var integer Default template id and used to check if changed form from last query
*
* @since 1.5
*/
Expand All @@ -67,9 +69,9 @@ public static function getAdmin(): object
{
if (!isset(self::$admin)) {
try {
$app = Factory::getApplication();
$app = Factory::getApplication();
} catch (\Exception $e) {
return self::$admin;
echo $e->getMessage();
}
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
Expand Down
3 changes: 2 additions & 1 deletion admin/tmpl/cwmcpanel/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
// Load the tooltip behavior.
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
$wa->useScript('multiselect');
$wa->useScript('core')
->useScript('bootstrap.dropdown');

$msg = '';
$input = new Input();
Expand Down
9 changes: 9 additions & 0 deletions build.dist.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Build properties for multiple use times
# This property is required!
builder.joomla_path=/path/to/server/htdocs/like/folder

# Staging directory if you use this.
builder.joomla_dir=

# Joomla version to run the unit tests against
joomla.version=4.2.4
102 changes: 42 additions & 60 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
<property name="basedir" value="${project.basedir}"/>
<property name="project.name" value="Proclaim"/>

<!-- Joomla version to run the unit tests against -->
<property name="joomla.version" value="4.2.4"/>
<!-- We try and verify that the build.properties file is created from the build.dist.properties -->
<if>
<available file="build.properties" property="build_properties_exists" type="file"/>
<then>
<property file="build.properties"/>
</then>
<else>
<fail>-
Missing 'build.properties' file in the project root folder
</fail>
</else>
</if>

<property name="config_path" value="${basedir}/tests/system/servers"/>

Expand Down Expand Up @@ -36,24 +46,6 @@
</phplint>
</target>

<!-- <target name="phpunit" depends="init"-->
<!-- description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">-->
<!-- <phpunit haltonfailure="true" haltonerror="true" bootstrap="${basedir}/tests/unit/bootstrap.php">-->
<!-- &lt;!&ndash; We can only use one formatter at a time &ndash;&gt;-->
<!-- <formatter todir="${basedir}/build/reports" type="plain" outfile="test-brief.txt"/>-->
<!-- <batchtest>-->
<!-- <fileset dir="${basedir}/tests/unit/suites/" includes="**/*.php"/>-->
<!-- </batchtest>-->
<!-- </phpunit>-->
<!-- </target>-->

<!-- Measure the size of the project -->
<!-- <target name="size" description="Measures the size of the project">-->
<!-- <phploc countTests="true" reportType="txt" reportName="project-size" reportDirectory="${basedir}/build/reports">-->
<!-- <fileset refid="distributed_files"/>-->
<!-- </phploc>-->
<!-- </target>-->

<!-- Detect violations in coding standards -->
<target name="phpcs" depends="init" description="Generate checkstyle.xml using PHP_CodeSniffer">
<phpcodesniffer standard="PEAR" format="summary" showSniffs="true" showWarnings="true" haltonerror="true">
Expand Down Expand Up @@ -84,7 +76,7 @@

<!-- Create com_proclaim-x.x.x.zip -->
<target name="component" depends="init,dev.clean" description="Builds the component">
<input message="Enter the version you are building." propertyName="version" defaultValue="10.0.x"/>
<input message="Enter the version you are building. ex. 10.0.0" propertyName="version" defaultValue="10.0.x"/>
<delete file="${basedir}/build/com_proclaim-${version}.zip"/>
<zip destfile="${basedir}/build/com_proclaim-${version}.zip">
<fileset defaultexcludes="true" dir=".">
Expand Down Expand Up @@ -146,22 +138,8 @@
<delete dir="${basedir}/tests/.joomla-dev" includeemptydirs="true"/>
</target>

<!-- <target name="test.system" depends="init"-->
<!-- description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">-->
<!-- <phpunit haltonfailure="true" haltonerror="true" bootstrap="${basedir}/tests/system/servers/configdef.php">-->
<!-- &lt;!&ndash; We can only use one formatter at a time &ndash;&gt;-->
<!-- <formatter todir="${basedir}/build/reports" type="plain" outfile="test-brief.txt"/>-->
<!-- <batchtest>-->
<!-- <fileset dir="${basedir}/tests/system/tests/installation" includes="**/*.php"/>-->
<!-- </batchtest>-->
<!-- </phpunit>-->
<!-- </target>-->

<!-- Set the default joomla path and create symbolic links -->
<target name="dev.setup">
<input message="Enter the path to your Joomla! root directory" propertyName="joomla_path"
defaultValue="/Applications/MAMP/htdocs/"/>
<input message="Enter Joomla folder name" propertyName="joomla_dir" defaultValue="joomla-dev"/>
<input message="Stage Joomla?" propertyName="stage_joomla" defaultValue="n"/>
<if>
<equals arg1="${stage_joomla}" arg2="y"/>
Expand All @@ -172,66 +150,70 @@
<property name="force" value="${stage_joomla"/>
</phingcall>
<!--Link Joomla to the webserver's root directory -->
<symlink target="${basedir}/.joomla-dev" link="${joomla_path}/${joomla_dir}" overwrite="true"/>
<symlink target="${basedir}/.joomla-dev" link="${builder.joomla_path}/${builder.joomla_dir}"
overwrite="true"/>
</then>
</if>

<echo message="Joomla path set to: ${joomla_path}${joomla_dir}"/>
<echo message="Joomla path set to: ${builder.joomla_path}${builder.joomla_dir}"/>

<echo message="Linking component to Joomla!"/>

<!-- Create symbolic links for component in the Joomla directory -->
<symlink target="${basedir}/media" link="${joomla_path}${joomla_dir}/media/com_proclaim" overwrite="true"/>
<symlink target="${basedir}/admin" link="${joomla_path}${joomla_dir}/administrator/components/com_proclaim"
<!-- Create symbolic links for a component in the Joomla directory -->
<symlink target="${basedir}/media" link="${builder.joomla_path}${builder.joomla_dir}/media/com_proclaim"
overwrite="true"/>
<symlink target="${basedir}/site" link="${joomla_path}${joomla_dir}/components/com_proclaim"
<symlink target="${basedir}/admin"
link="${builder.joomla_path}${builder.joomla_dir}/administrator/components/com_proclaim"
overwrite="true"/>
<symlink target="${basedir}/site" link="${builder.joomla_path}${builder.joomla_dir}/components/com_proclaim"
overwrite="true"/>
<symlink target="${basedir}/modules/site/mod_proclaim"
link="${joomla_path}${joomla_dir}/modules/mod_proclaim" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/modules/mod_proclaim" overwrite="true"/>
<symlink target="${basedir}/modules/site/mod_proclaim_podcast"
link="${joomla_path}${joomla_dir}/modules/proclaim_podcast" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/modules/proclaim_podcast" overwrite="true"/>
<symlink target="${basedir}/plugins/system/proclaimbackup"
link="${joomla_path}${joomla_dir}/plugins/system/proclaimbackup" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/plugins/system/proclaimbackup" overwrite="true"/>
<symlink target="${basedir}/plugins/finder/proclaim"
link="${joomla_path}${joomla_dir}/plugins/finder/proclaim" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/plugins/finder/proclaim" overwrite="true"/>
<symlink target="${basedir}/plugins/system/proclaimpodcast"
link="${joomla_path}${joomla_dir}/plugins/system/proclaimpodcast" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/plugins/system/proclaimpodcast" overwrite="true"/>

<phingcall target="dev.init"/>
</target>

<!-- Set the default joomla path and create symbolic links -->
<target name="dev.setup_Symbolic_Links">
<input message="Enter the path to your Joomla! root directory" propertyName="joomla_path"
defaultValue="/Applications/MAMP/htdocs/"/>
<input message="Stage Joomla?" propertyName="joomla_dir" defaultValue="n"/>
<propertyprompt propertyName="joomla_dir" defaultValue="joomla-dev" promptText="Set Joomla folder name"/>

<echo message="Joomla path set to: ${joomla_path}${joomla_dir}"/>
<echo message="Joomla path set to: ${builder.joomla_path}${builder.joomla_dir}"/>

<echo message="Linking component, modules, and plugins to Joomla!"/>

<!-- Create symbolic links for component in the Joomla directory -->
<symlink target="${basedir}/media" link="${joomla_path}${joomla_dir}/media/com_proclaim" overwrite="true"/>
<symlink target="${basedir}/admin" link="${joomla_path}${joomla_dir}/administrator/components/com_proclaim"
<symlink target="${basedir}/media" link="${builder.joomla_path}${builder.joomla_dir}/media/com_proclaim"
overwrite="true"/>
<symlink target="${basedir}/admin"
link="${builder.joomla_path}${builder.joomla_dir}/administrator/components/com_proclaim"
overwrite="true"/>
<symlink target="${basedir}/site" link="${joomla_path}${joomla_dir}/components/com_proclaim"
<symlink target="${basedir}/site" link="${builder.joomla_path}${builder.joomla_dir}/components/com_proclaim"
overwrite="true"/>
<symlink target="${basedir}/modules/site/mod_proclaim"
link="${joomla_path}${joomla_dir}/modules/mod_proclaim" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/modules/mod_proclaim" overwrite="true"/>
<symlink target="${basedir}/modules/admin/mod_proclaimicon"
link="${builder.joomla_path}${builder.joomla_dir}/administrator/modules/mod_proclaimicon"
overwrite="true"/>
<symlink target="${basedir}/modules/site/mod_proclaim_podcast"
link="${joomla_path}${joomla_dir}/modules/mod_proclaim_podcast" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/modules/mod_proclaim_podcast" overwrite="true"/>
<symlink target="${basedir}/plugins/finder/proclaim"
link="${joomla_path}${joomla_dir}/plugins/finder/proclaim" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/plugins/finder/proclaim" overwrite="true"/>
<symlink target="${basedir}/plugins/task/proclaim"
link="${joomla_path}${joomla_dir}/plugins/task/proclaim" overwrite="true"/>
link="${builder.joomla_path}${builder.joomla_dir}/plugins/task/proclaim" overwrite="true"/>

<phingcall target="dev.init"/>
</target>

<!-- Create symbolic links for the development state -->
<target name="dev.init">
<echo message="Initializing a development state"/>
<echo message="Initializing a symbolic links in development state"/>
<symlink target="${basedir}/proclaim.xml" link="${basedir}/admin/proclaim.xml" overwrite="true"/>
<symlink target="${basedir}/proclaim.script.php" link="${basedir}/admin/proclaim.script.php"
overwrite="true"/>
Expand All @@ -242,7 +224,7 @@

<!-- Clean up symbolic links from the development state -->
<target name="dev.clean">
<echo message="Cleaning up development state"/>
<echo message="Cleaning up symbolic links in development state"/>
<delete file="${basedir}/admin/proclaim.xml"/>
<delete file="${basedir}/admin/proclaim.script.php"/>
<delete file="${basedir}/media/css/site/cwmcore.css"/>
Expand Down
Loading

0 comments on commit e625973

Please sign in to comment.