File manager - Edit - /home/opticamezl/www/newok/com_content.tar
Back
helpers/content.php 0000644 00000001274 15172746405 0010410 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace */ // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Content component helper. * * @since 1.6 * * @deprecated 4.3 will be removed in 6.0 * Use \Joomla\Component\Content\Administrator\Helper\ContentHelper instead */ class ContentHelper extends \Joomla\Component\Content\Administrator\Helper\ContentHelper { } helpers/index.html 0000604 00000000037 15172746405 0010212 0 ustar 00 <!DOCTYPE html><title></title> forms/filter_articles.xml 0000644 00000012224 15172746405 0011603 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <form> <fields name="filter"> <field name="search" type="text" inputmode="search" label="COM_CONTENT_FILTER_SEARCH_LABEL" description="COM_CONTENT_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" /> <field name="featured" type="list" label="JFEATURED" class="js-select-submit-on-change" default="" validate="options" > <option value="">COM_CONTENT_SELECT_FEATURED</option> <option value="0">COM_CONTENT_FILTER_FEATURED_NO</option> <option value="1">COM_CONTENT_FILTER_FEATURED_YES</option> </field> <field name="stage" type="workflowstage" label="JOPTION_SELECT_STAGE" class="js-select-submit-on-change" activeonly="true" extension="com_content.article" > <option value="">JOPTION_SELECT_STAGE</option> </field> <field name="published" type="status" label="JOPTION_SELECT_PUBLISHED" class="js-select-submit-on-change" extension="com_content" > <option value="">JOPTION_SELECT_PUBLISHED</option> </field> <field name="category_id" type="category" label="JCATEGORY" multiple="true" extension="com_content" layout="joomla.form.field.list-fancy-select" hint="JOPTION_SELECT_CATEGORY" class="js-select-submit-on-change" published="0,1,2" /> <field name="access" type="accesslevel" label="JGRID_HEADING_ACCESS" multiple="true" layout="joomla.form.field.list-fancy-select" hint="JOPTION_SELECT_ACCESS" class="js-select-submit-on-change" /> <field name="author_id" type="author" label="JOPTION_SELECT_AUTHOR" multiple="true" layout="joomla.form.field.list-fancy-select" hint="JOPTION_SELECT_AUTHOR" class="js-select-submit-on-change" > <option value="0">JNONE</option> <option value="by_me">COM_CONTENT_FILTER_AUTHORS_BY_ME</option> </field> <field name="language" type="contentlanguage" label="JGRID_HEADING_LANGUAGE" class="js-select-submit-on-change" > <option value="">JOPTION_SELECT_LANGUAGE</option> <option value="*">JALL</option> </field> <field name="tag" type="tag" multiple="true" label="JTAG" hint="JOPTION_SELECT_TAG" mode="nested" custom="false" class="js-select-submit-on-change" /> <field name="level" type="integer" label="JGLOBAL_MAXLEVEL_LABEL" first="1" last="10" step="1" languages="*" class="js-select-submit-on-change" > <option value="">JOPTION_SELECT_MAX_LEVELS</option> </field> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" class="js-select-submit-on-change" default="a.id DESC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option> <option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option> <option value="a.featured ASC">JFEATURED_ASC</option> <option value="a.featured DESC">JFEATURED_DESC</option> <option value="a.state ASC">JSTATUS_ASC</option> <option value="a.state DESC">JSTATUS_DESC</option> <option value="a.title ASC">JGLOBAL_TITLE_ASC</option> <option value="a.title DESC">JGLOBAL_TITLE_DESC</option> <option value="category_title ASC">JCATEGORY_ASC</option> <option value="category_title DESC">JCATEGORY_DESC</option> <option value="a.access ASC">JGRID_HEADING_ACCESS_ASC</option> <option value="a.access DESC">JGRID_HEADING_ACCESS_DESC</option> <option value="a.created_by ASC">JAUTHOR_ASC</option> <option value="a.created_by DESC">JAUTHOR_DESC</option> <option value="association ASC" requires="associations">JASSOCIATIONS_ASC</option> <option value="association DESC" requires="associations">JASSOCIATIONS_DESC</option> <option value="language ASC" requires="multilanguage">JGRID_HEADING_LANGUAGE_ASC</option> <option value="language DESC" requires="multilanguage">JGRID_HEADING_LANGUAGE_DESC</option> <option value="a.created ASC">JDATE_ASC</option> <option value="a.created DESC">JDATE_DESC</option> <option value="a.modified ASC">COM_CONTENT_MODIFIED_ASC</option> <option value="a.modified DESC">COM_CONTENT_MODIFIED_DESC</option> <option value="a.publish_up ASC">COM_CONTENT_PUBLISH_UP_ASC</option> <option value="a.publish_up DESC">COM_CONTENT_PUBLISH_UP_DESC</option> <option value="a.publish_down ASC">COM_CONTENT_PUBLISH_DOWN_ASC</option> <option value="a.publish_down DESC">COM_CONTENT_PUBLISH_DOWN_DESC</option> <option value="a.hits ASC" requires="hits">JGLOBAL_HITS_ASC</option> <option value="a.hits DESC" requires="hits">JGLOBAL_HITS_DESC</option> <option value="rating_count ASC" requires="vote">JGLOBAL_VOTES_ASC</option> <option value="rating_count DESC" requires="vote">JGLOBAL_VOTES_DESC</option> <option value="rating ASC" requires="vote">JGLOBAL_RATINGS_ASC</option> <option value="rating DESC" requires="vote">JGLOBAL_RATINGS_DESC</option> <option value="a.id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="limitbox" label="JGLOBAL_LIST_LIMIT" default="25" class="js-select-submit-on-change" /> </fields> </form> forms/category.xml 0000644 00000001243 15172746405 0010244 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <form> <help key="Articles:_Edit_Category" /> <listhelp key="Articles:_Categories" /> <fields name="params" addfieldprefix="Joomla\Component\Content\Administrator\Field"> <fieldset name="workflow" label="COM_CONTENT_WORKFLOW"> <field name="workflow_id" type="sql" label="COM_CONTENT_WORKFLOWS" class="form-select" sql_select="id, title" sql_from="#__workflows" sql_where="published = 1 AND extension = 'com_content.article'" sql_order="ordering" key_field="id" value_field="title" required="true" default="use_default" translate="true" /> </fieldset> </fields> </form> forms/filter_featured.xml 0000644 00000010515 15172746405 0011575 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <form> <fields name="filter"> <field name="search" type="text" inputmode="search" label="COM_CONTENT_FILTER_SEARCH_LABEL" description="COM_CONTENT_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" /> <field name="stage" type="workflowstage" label="JOPTION_SELECT_STAGE" class="js-select-submit-on-change" activeonly="true" extension="com_content.article" > <option value="">JOPTION_SELECT_STAGE</option> </field> <field name="published" type="status" label="JOPTION_SELECT_PUBLISHED" class="js-select-submit-on-change" extension="com_content.article" > <option value="">JOPTION_SELECT_PUBLISHED</option> </field> <field name="category_id" type="category" label="JCATEGORY" multiple="true" extension="com_content" layout="joomla.form.field.list-fancy-select" hint="JOPTION_SELECT_CATEGORY" class="js-select-submit-on-change" /> <field name="access" type="accesslevel" label="JGRID_HEADING_ACCESS" multiple="true" layout="joomla.form.field.list-fancy-select" hint="JOPTION_SELECT_ACCESS" class="js-select-submit-on-change" /> <field name="author_id" type="author" label="JOPTION_SELECT_AUTHOR" multiple="true" layout="joomla.form.field.list-fancy-select" hint="JOPTION_SELECT_AUTHOR" class="js-select-submit-on-change" > <option value="0">JNONE</option> </field> <field name="language" type="contentlanguage" label="JGRID_HEADING_LANGUAGE" class="js-select-submit-on-change" > <option value="">JOPTION_SELECT_LANGUAGE</option> <option value="*">JALL</option> </field> <field name="tag" type="tag" label="JTAG" multiple="true" mode="nested" custom="false" hint="JOPTION_SELECT_TAG" class="js-select-submit-on-change" /> <field name="level" type="integer" label="JGLOBAL_MAXLEVEL_LABEL" first="1" last="10" step="1" languages="*" class="js-select-submit-on-change" > <option value="">JOPTION_SELECT_MAX_LEVELS</option> </field> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" class="js-select-submit-on-change" default="a.title ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="fp.ordering ASC">JGRID_HEADING_ORDERING_ASC</option> <option value="fp.ordering DESC">JGRID_HEADING_ORDERING_DESC</option> <option value="a.state ASC">JSTATUS_ASC</option> <option value="a.state DESC">JSTATUS_DESC</option> <option value="a.title ASC">JGLOBAL_TITLE_ASC</option> <option value="a.title DESC">JGLOBAL_TITLE_DESC</option> <option value="category_title ASC">JCATEGORY_ASC</option> <option value="category_title DESC">JCATEGORY_DESC</option> <option value="a.access ASC">JGRID_HEADING_ACCESS_ASC</option> <option value="a.access DESC">JGRID_HEADING_ACCESS_DESC</option> <option value="a.created_by ASC">JAUTHOR_ASC</option> <option value="a.created_by DESC">JAUTHOR_DESC</option> <option value="a.publish_up ASC">COM_CONTENT_PUBLISH_UP_ASC</option> <option value="a.publish_up DESC">COM_CONTENT_PUBLISH_UP_DESC</option> <option value="a.publish_down ASC">COM_CONTENT_PUBLISH_DOWN_ASC</option> <option value="a.publish_down DESC">COM_CONTENT_PUBLISH_DOWN_DESC</option> <option value="language ASC" requires="multilanguage">JGRID_HEADING_LANGUAGE_ASC</option> <option value="language DESC" requires="multilanguage">JGRID_HEADING_LANGUAGE_DESC</option> <option value="a.created ASC">JDATE_ASC</option> <option value="a.created DESC">JDATE_DESC</option> <option value="a.hits ASC" requires="hits">JGLOBAL_HITS_ASC</option> <option value="a.hits DESC" requires="hits">JGLOBAL_HITS_DESC</option> <option value="rating_count ASC" requires="vote">JGLOBAL_VOTES_ASC</option> <option value="rating_count DESC" requires="vote">JGLOBAL_VOTES_DESC</option> <option value="rating ASC" requires="vote">JGLOBAL_RATINGS_ASC</option> <option value="rating DESC" requires="vote">JGLOBAL_RATINGS_DESC</option> <option value="a.id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="limitbox" label="JGLOBAL_LIST_LIMIT" default="25" class="js-select-submit-on-change" /> </fields> </form> forms/article.xml 0000644 00000046211 15172746405 0010056 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <form> <config> <inlinehelp button="show"/> </config> <fieldset addfieldprefix="Joomla\Component\Content\Administrator\Field"> <field name="id" type="text" label="JGLOBAL_FIELD_ID_LABEL" class="readonly" default="0" readonly="true" /> <field name="asset_id" type="hidden" filter="unset" /> <field name="title" type="text" label="JGLOBAL_TITLE" required="true" maxlength="255" /> <field name="alias" type="text" label="JFIELD_ALIAS_LABEL" description="JFIELD_ALIAS_DESC" hint="JFIELD_ALIAS_PLACEHOLDER" /> <field name="note" type="text" label="COM_CONTENT_FIELD_NOTE_LABEL" maxlength="255" /> <field name="version_note" type="text" label="JGLOBAL_FIELD_VERSION_NOTE_LABEL" maxlength="255" /> <field name="articletext" type="editor" label="COM_CONTENT_FIELD_ARTICLETEXT_LABEL" filter="JComponentHelper::filterText" buttons="true" /> <field name="catid" type="categoryedit" label="JCATEGORY" addfieldprefix="Joomla\Component\Categories\Administrator\Field" required="true" default="" /> <field name="state" type="list" label="JSTATUS" class="form-select-color-state" default="1" validate="options" > <option value="1">JPUBLISHED</option> <option value="0">JUNPUBLISHED</option> <option value="2">JARCHIVED</option> <option value="-2">JTRASHED</option> </field> <field name="tags" type="tag" label="JTAG" multiple="true" /> <field name="created" type="calendar" label="COM_CONTENT_FIELD_CREATED_LABEL" translateformat="true" showtime="true" filter="user_utc" /> <field name="created_by" type="user" label="COM_CONTENT_FIELD_CREATED_BY_LABEL" validate="UserId" /> <field name="created_by_alias" type="text" label="COM_CONTENT_FIELD_CREATED_BY_ALIAS_LABEL" /> <field name="modified" type="calendar" label="JGLOBAL_FIELD_MODIFIED_LABEL" class="form-control" translateformat="true" showtime="true" readonly="true" filter="user_utc" /> <field name="modified_by" type="user" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL" class="readonly" readonly="true" filter="unset" validate="UserId" /> <field name="checked_out" type="hidden" filter="unset" /> <field name="checked_out_time" type="hidden" filter="unset" /> <field name="publish_up" type="calendar" label="COM_CONTENT_FIELD_PUBLISH_UP_LABEL" translateformat="true" showtime="true" filter="user_utc" /> <field name="publish_down" type="calendar" label="COM_CONTENT_FIELD_PUBLISH_DOWN_LABEL" translateformat="true" showtime="true" filter="user_utc" /> <field name="featured_up" type="calendar" label="COM_CONTENT_FIELD_FEATURED_UP_LABEL" translateformat="true" showtime="true" filter="user_utc" /> <field name="featured_down" type="calendar" label="COM_CONTENT_FIELD_FEATURED_DOWN_LABEL" translateformat="true" showtime="true" filter="user_utc" /> <field name="version" type="text" label="COM_CONTENT_FIELD_VERSION_LABEL" class="readonly" readonly="true" filter="unset" /> <field name="ordering" type="text" label="JFIELD_ORDERING_LABEL" default="0" /> <field name="metakey" type="textarea" label="JFIELD_META_KEYWORDS_LABEL" rows="3" cols="30" /> <field name="metadesc" type="textarea" label="JFIELD_META_DESCRIPTION_LABEL" rows="3" cols="30" maxlength="160" charcounter="true" /> <field name="access" type="accesslevel" label="JFIELD_ACCESS_LABEL" filter="UINT" validate="options" /> <field name="hits" type="text" label="JGLOBAL_HITS" class="readonly" readonly="true" filter="unset" default="0" /> <field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" > <option value="*">JALL</option> </field> <field name="featured" type="radio" label="JFEATURED" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="rules" type="rules" label="JFIELD_RULES_LABEL" translate_label="false" filter="rules" component="com_content" section="article" validate="rules" /> </fieldset> <fields name="attribs" label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL"> <fieldset name="attribs" label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL"> <fieldset name="basic" label="JFIELD_ALT_LAYOUT_LABEL"> <field name="article_layout" type="componentlayout" label="JFIELD_ALT_LAYOUT_LABEL" class="form-select" useglobal="true" extension="com_content" view="article" /> <field name="show_title" type="list" label="JGLOBAL_SHOW_TITLE_LABEL" useglobal="true" validate="options" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="link_titles" type="list" label="JGLOBAL_LINKED_TITLES_LABEL" useglobal="true" validate="options" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_tags" type="list" label="COM_CONTENT_FIELD_SHOW_TAGS_LABEL" class="form-select-color" useglobal="true" validate="options" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="show_intro" type="list" label="JGLOBAL_SHOW_INTRO_LABEL" class="form-select-color" useglobal="true" validate="options" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="info_block_position" type="list" label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL" useglobal="true" validate="options" > <option value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option> <option value="1">COM_CONTENT_FIELD_OPTION_BELOW</option> <option value="2">COM_CONTENT_FIELD_OPTION_SPLIT</option> </field> <field name="info_block_show_title" type="list" label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="category" label="JCATEGORY"> <field name="show_category" type="list" label="JGLOBAL_SHOW_CATEGORY_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="link_category" type="list" label="JGLOBAL_LINK_CATEGORY_LABEL" useglobal="true" validate="options" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_parent_category" type="list" label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="link_parent_category" type="list" label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL" useglobal="true" validate="options" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="frontendassociations" label="JGLOBAL_FIELDSET_ASSOCIATIONS"> <field name="show_associations" type="assoc" label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL" useglobal="true" > <option value="1">JSHOW</option> <option value="0">JHIDE</option> </field> <field name="flags" type="list" label="JGLOBAL_SHOW_FLAG_LABEL" useglobal="true" showon="show_associations:1" validate="options" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="author" label="JGLOBAL_SHOW_AUTHOR_LABEL"> <field name="show_author" type="list" label="JGLOBAL_SHOW_AUTHOR_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="link_author" type="list" label="JGLOBAL_LINK_AUTHOR_LABEL" useglobal="true" validate="options" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="date" label="JDATE"> <field name="show_create_date" type="list" label="JGLOBAL_SHOW_CREATE_DATE_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_modify_date" type="list" label="JGLOBAL_SHOW_MODIFY_DATE_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_publish_date" type="list" label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="other" label="COM_CONTENT_OTHER_OPTIONS"> <field name="show_item_navigation" type="list" label="JGLOBAL_SHOW_NAVIGATION_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_vote" type="votelist" label="JGLOBAL_SHOW_VOTE_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_hits" type="list" label="JGLOBAL_SHOW_HITS_LABEL" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_noauth" type="list" label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL" description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC" useglobal="true" validate="options" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="urls_position" type="list" label="COM_CONTENT_FIELD_URLSPOSITION_LABEL" useglobal="true" filter="integer" validate="options" > <option value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option> <option value="1">COM_CONTENT_FIELD_OPTION_BELOW</option> <option value="-1">JHIDE</option> </field> <field name="alternative_readmore" type="text" label="JFIELD_READMORE_LABEL" description="JFIELD_READMORE_DESC" /> <field name="article_page_title" type="text" label="COM_CONTENT_FIELD_BROWSER_PAGE_TITLE_LABEL" /> </fieldset> </fieldset> <fieldset name="editorConfig" label="COM_CONTENT_EDITORCONFIG_FIELDSET_LABEL"> <field name="show_publishing_options" type="list" label="COM_CONTENT_SHOW_PUBLISHING_OPTIONS_LABEL" default="" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_article_options" type="list" label="COM_CONTENT_SHOW_ARTICLE_OPTIONS_LABEL" default="" useglobal="true" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_urls_images_backend" type="list" label="COM_CONTENT_SHOW_IMAGES_URLS_BACK_LABEL" useglobal="true" default="" validate="options" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_urls_images_frontend" type="list" label="COM_CONTENT_SHOW_IMAGES_URLS_FRONT_LABEL" useglobal="true" default="" validate="options" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="basic-limited" label="COM_CONTENT_ATTRIBS_FIELDSET_LABEL"> <field name="show_title" type="hidden" label="JGLOBAL_SHOW_TITLE_LABEL" /> <field name="link_titles" type="hidden" label="JGLOBAL_LINKED_TITLES_LABEL" /> <field name="show_intro" type="hidden" label="JGLOBAL_SHOW_INTRO_LABEL" /> <field name="show_category" type="hidden" label="JGLOBAL_SHOW_CATEGORY_LABEL" /> <field name="link_category" type="hidden" label="JGLOBAL_LINK_CATEGORY_LABEL" /> <field name="show_parent_category" type="hidden" label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL" /> <field name="link_parent_category" type="hidden" label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL" /> <field name="show_author" type="hidden" label="JGLOBAL_SHOW_AUTHOR_LABEL" /> <field name="link_author" type="hidden" label="JGLOBAL_LINK_AUTHOR_LABEL" /> <field name="show_create_date" type="hidden" label="JGLOBAL_SHOW_CREATE_DATE_LABEL" /> <field name="show_modify_date" type="hidden" label="JGLOBAL_SHOW_MODIFY_DATE_LABEL" /> <field name="show_publish_date" type="hidden" label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL" /> <field name="show_item_navigation" type="hidden" label="JGLOBAL_SHOW_NAVIGATION_LABEL" /> <field name="show_vote" type="hidden" label="JGLOBAL_SHOW_VOTE_LABEL" /> <field name="show_hits" type="hidden" label="JGLOBAL_SHOW_HITS_LABEL" /> <field name="show_noauth" type="hidden" label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL" description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC" /> <field name="alternative_readmore" type="hidden" label="JFIELD_READMORE_LABEL" description="JFIELD_READMORE_DESC" /> <field name="article_layout" type="hidden" label="JFIELD_ALT_LAYOUT_LABEL" useglobal="true" extension="com_content" view="article" /> </fieldset> </fields> <fields name="images" label="COM_CONTENT_FIELD_IMAGE_OPTIONS"> <fieldset name="image-intro" label="COM_CONTENT_FIELD_INTRO_LABEL"> <field name="image_intro" type="media" label="COM_CONTENT_FIELD_INTRO_LABEL" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" /> <field name="image_intro_alt" type="text" label="COM_CONTENT_FIELD_IMAGE_ALT_LABEL" /> <field name="image_intro_alt_empty" type="checkbox" label="COM_CONTENT_FIELD_IMAGE_ALT_EMPTY_LABEL" description="COM_CONTENT_FIELD_IMAGE_ALT_EMPTY_DESC" /> <field name="float_intro" type="text" label="COM_CONTENT_FIELD_IMAGE_CLASS_LABEL" description="COM_CONTENT_FIELD_IMAGE_CLASS_DESC" useglobal="true" validate="CssIdentifier" /> <field name="image_intro_caption" type="text" label="COM_CONTENT_FIELD_IMAGE_CAPTION_LABEL" /> </fieldset> <fieldset name="image-full" label="COM_CONTENT_FIELD_FULL_LABEL"> <field name="image_fulltext" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONTENT_FIELD_FULL_LABEL" /> <field name="image_fulltext_alt" type="text" label="COM_CONTENT_FIELD_IMAGE_ALT_LABEL" /> <field name="image_fulltext_alt_empty" type="checkbox" label="COM_CONTENT_FIELD_IMAGE_ALT_EMPTY_LABEL" description="COM_CONTENT_FIELD_IMAGE_ALT_EMPTY_DESC" /> <field name="float_fulltext" type="text" label="COM_CONTENT_FIELD_IMAGE_CLASS_LABEL" description="COM_CONTENT_FIELD_IMAGE_CLASS_DESC" useglobal="true" validate="CssIdentifier" /> <field name="image_fulltext_caption" type="text" label="COM_CONTENT_FIELD_IMAGE_CAPTION_LABEL" /> </fieldset> </fields> <fields name="urls" label="COM_CONTENT_FIELD_URLS_OPTIONS"> <fieldset name="linka" label="COM_CONTENT_FIELD_URLA_LABEL"> <field name="urla" type="url" label="COM_CONTENT_FIELD_URLA_LABEL" validate="url" filter="url" relative="true" /> <field name="urlatext" type="text" label="COM_CONTENT_FIELD_URLA_LINK_TEXT_LABEL" /> <field name="targeta" type="list" label="COM_CONTENT_URL_FIELD_BROWSERNAV_LABEL" default="" filter="options" useglobal="true" validate="options" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> </fieldset> <fieldset name="linkb" label="COM_CONTENT_FIELD_URLB_LABEL"> <field name="urlb" type="url" label="COM_CONTENT_FIELD_URLB_LABEL" validate="url" filter="url" relative="true" /> <field name="urlbtext" type="text" label="COM_CONTENT_FIELD_URLB_LINK_TEXT_LABEL" /> <field name="targetb" type="list" label="COM_CONTENT_URL_FIELD_BROWSERNAV_LABEL" default="" filter="options" useglobal="true" validate="options" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> </fieldset> <fieldset name="linkc" label="COM_CONTENT_FIELD_URLC_LABEL"> <field name="urlc" type="url" label="COM_CONTENT_FIELD_URLC_LABEL" validate="url" filter="url" relative="true" /> <field name="urlctext" type="text" label="COM_CONTENT_FIELD_URLC_LINK_TEXT_LABEL" /> <field name="targetc" type="list" label="COM_CONTENT_URL_FIELD_BROWSERNAV_LABEL" default="" filter="options" useglobal="true" validate="options" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> </fieldset> </fields> <fields name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"> <fieldset name="jmetadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"> <field name="robots" type="list" label="JFIELD_METADATA_ROBOTS_LABEL" validate="options" > <option value="">JGLOBAL_USE_GLOBAL</option> <option value="index, follow" /> <option value="noindex, follow" /> <option value="index, nofollow" /> <option value="noindex, nofollow" /> </field> <field name="author" type="text" label="JAUTHOR" /> <field name="rights" type="textarea" label="JFIELD_META_RIGHTS_LABEL" filter="string" cols="30" rows="2" /> </fieldset> </fields> <!-- These fields are used to get labels for the Content History Preview and Compare Views --> <fields> <field name="introtext" label="COM_CONTENT_FIELD_INTROTEXT" filter="JComponentHelper::filterText" /> <field name="fulltext" label="COM_CONTENT_FIELD_FULLTEXT" filter="JComponentHelper::filterText" /> </fields> </form> index.html 0000604 00000000037 15172746405 0006550 0 ustar 00 <!DOCTYPE html><title></title> content.xml 0000644 00000002731 15172746405 0006756 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <extension type="component" method="upgrade"> <name>com_content</name> <author>Joomla! Project</author> <creationDate>2006-04</creationDate> <copyright>(C) 2006 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>4.0.0</version> <description>COM_CONTENT_XML_DESCRIPTION</description> <namespace path="src">Joomla\Component\Content</namespace> <files folder="site"> <folder>forms</folder> <folder>helpers</folder> <folder>src</folder> <folder>tmpl</folder> </files> <languages folder="site"> <language tag="en-GB">language/en-GB/com_content.ini</language> </languages> <media destination="com_content" folder="media"> <folder>js</folder> </media> <administration> <files folder="admin"> <filename>access.xml</filename> <filename>config.xml</filename> <filename>content.xml</filename> <folder>forms</folder> <folder>helpers</folder> <folder>services</folder> <folder>src</folder> <folder>tmpl</folder> </files> <languages folder="admin"> <language tag="en-GB">language/en-GB/com_content.ini</language> <language tag="en-GB">language/en-GB/com_content.sys.ini</language> </languages> </administration> <dashboards> <dashboard title="COM_CONTENT_DASHBOARD_TITLE" icon="icon-file-alt">content</dashboard> </dashboards> </extension> access.xml 0000644 00000005435 15172746405 0006551 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <access component="com_content"> <section name="component"> <action name="core.admin" title="JACTION_ADMIN" /> <action name="core.options" title="JACTION_OPTIONS" /> <action name="core.manage" title="JACTION_MANAGE" /> <action name="core.create" title="JACTION_CREATE" /> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> <action name="core.edit.own" title="JACTION_EDITOWN" /> <action name="core.edit.value" title="JACTION_EDITVALUE" /> <action name="core.manage.workflow" title="JACTION_MANAGEWORKFLOW" /> <action name="core.execute.transition" title="JACTION_EXECUTETRANSITION" /> </section> <section name="category"> <action name="core.create" title="JACTION_CREATE" /> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> <action name="core.edit.own" title="JACTION_EDITOWN" /> </section> <section name="article"> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> </section> <section name="fieldgroup"> <action name="core.create" title="JACTION_CREATE" /> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> <action name="core.edit.own" title="JACTION_EDITOWN" /> <action name="core.edit.value" title="JACTION_EDITVALUE" /> </section> <section name="field"> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> <action name="core.edit.value" title="JACTION_EDITVALUE" /> </section> <section name="workflow"> <action name="core.create" title="JACTION_CREATE" /> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> <action name="core.edit.own" title="JACTION_EDITOWN" /> <action name="core.execute.transition" title="JACTION_EXECUTETRANSITION" /> </section> <section name="transition"> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> <action name="core.execute.transition" title="JACTION_EXECUTETRANSITION" /> </section> <section name="stage"> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> </section> </access> config.xml 0000644 00000063664 15172746405 0006565 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <config> <help key="Articles:_Options"/> <inlinehelp button="show"/> <fieldset name="articles" label="JGLOBAL_ARTICLES" description="COM_CONTENT_CONFIG_ARTICLE_SETTINGS_DESC" > <field name="article_layout" type="componentlayout" label="JGLOBAL_FIELD_LAYOUT_LABEL" class="form-select" menuitems="true" extension="com_content" view="article" /> <field name="show_title" type="radio" label="JGLOBAL_SHOW_TITLE_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="link_titles" type="radio" label="JGLOBAL_LINKED_TITLES_LABEL" layout="joomla.form.field.radio.switcher" default="1" showon="show_title:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_intro" type="radio" label="JGLOBAL_SHOW_INTRO_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="info_block_position" type="list" label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL" default="0" validate="options" > <option value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option> <option value="1">COM_CONTENT_FIELD_OPTION_BELOW</option> <option value="2">COM_CONTENT_FIELD_OPTION_SPLIT</option> </field> <field name="info_block_show_title" type="radio" label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_category" type="radio" label="JGLOBAL_SHOW_CATEGORY_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="link_category" type="radio" label="JGLOBAL_LINK_CATEGORY_LABEL" layout="joomla.form.field.radio.switcher" default="1" showon="show_category:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_parent_category" type="radio" label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="link_parent_category" type="radio" label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL" layout="joomla.form.field.radio.switcher" default="1" showon="show_parent_category:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="spacer1" type="spacer" hr="true" /> <field name="show_associations" type="radio" label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="flags" type="radio" label="JGLOBAL_SHOW_FLAG_LABEL" layout="joomla.form.field.radio.switcher" default="1" showon="show_associations:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="spacer3" type="spacer" hr="true" /> <field name="show_author" type="radio" label="JGLOBAL_SHOW_AUTHOR_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="link_author" type="radio" label="JGLOBAL_LINK_AUTHOR_LABEL" layout="joomla.form.field.radio.switcher" default="0" showon="show_author:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_create_date" type="radio" label="JGLOBAL_SHOW_CREATE_DATE_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_modify_date" type="radio" label="JGLOBAL_SHOW_MODIFY_DATE_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_publish_date" type="radio" label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_item_navigation" type="radio" label="JGLOBAL_SHOW_NAVIGATION_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_vote" type="voteradio" label="JGLOBAL_SHOW_VOTE_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_readmore" type="radio" label="JGLOBAL_SHOW_READMORE_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_readmore_title" type="radio" label="JGLOBAL_SHOW_READMORE_TITLE_LABEL" layout="joomla.form.field.radio.switcher" default="1" showon="show_readmore:1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="readmore_limit" type="number" label="JGLOBAL_SHOW_READMORE_LIMIT_LABEL" filter="integer" validate="number" min="0" default="100" showon="show_readmore:1[AND]show_readmore_title:1" /> <field name="show_tags" type="radio" label="COM_CONTENT_FIELD_SHOW_TAGS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="spacer2" type="spacer" hr="true" /> <field name="record_hits" type="radio" label="JGLOBAL_RECORD_HITS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="show_hits" type="radio" label="JGLOBAL_SHOW_HITS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_noauth" type="radio" label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL" description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="urls_position" type="list" label="COM_CONTENT_FIELD_URLSPOSITION_LABEL" default="0" filter="integer" validate="options" > <option value="0">COM_CONTENT_FIELD_OPTION_ABOVE</option> <option value="1">COM_CONTENT_FIELD_OPTION_BELOW</option> <option value="-1">JHIDE</option> </field> </fieldset> <fieldset name="editinglayout" label="COM_CONTENT_EDITING_LAYOUT" description="COM_CONTENT_CONFIG_EDITOR_LAYOUT" > <field name="captcha" type="plugins" label="COM_CONTENT_FIELD_CAPTCHA_LABEL" folder="captcha" filter="cmd" useglobal="true" > <option value="0">JOPTION_DO_NOT_USE</option> </field> <field name="show_publishing_options" type="radio" label="COM_CONTENT_SHOW_PUBLISHING_OPTIONS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_article_options" type="radio" label="COM_CONTENT_SHOW_ARTICLE_OPTIONS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_configure_edit_options" type="radio" label="COM_CONTENT_SHOW_CONFIGURE_EDIT_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_permissions" type="radio" label="COM_CONTENT_SHOW_PERMISSIONS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_associations_edit" type="radio" label="COM_CONTENT_SHOW_ASSOCIATIONS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="save_history" type="radio" label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="history_limit" type="number" label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" filter="integer" validate="number" min="0" default="10" showon="save_history:1" /> <field name="show_urls_images_frontend" type="radio" label="COM_CONTENT_SHOW_IMAGES_URLS_FRONT_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_urls_images_backend" type="radio" label="COM_CONTENT_SHOW_IMAGES_URLS_BACK_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="spacer3" type="spacer" hr="true" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" /> <field name="targeta" type="list" label="COM_CONTENT_URL_FIELD_A_BROWSERNAV_LABEL" default="Parent" filter="int" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" validate="options" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> <field name="targetb" type="list" label="COM_CONTENT_URL_FIELD_B_BROWSERNAV_LABEL" default="Parent" filter="int" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" validate="options" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> <field name="targetc" type="list" label="COM_CONTENT_URL_FIELD_C_BROWSERNAV_LABEL" default="Parent" filter="int" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" validate="options" > <option value="0">JBROWSERTARGET_PARENT</option> <option value="1">JBROWSERTARGET_NEW</option> <option value="2">JBROWSERTARGET_POPUP</option> <option value="3">JBROWSERTARGET_MODAL</option> </field> <field name="spacer4" type="spacer" hr="true" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" /> <field name="float_intro" type="text" label="COM_CONTENT_IMAGE_INTRO_CLASS_LABEL" validate="CssIdentifier" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" /> <field name="float_fulltext" type="text" label="COM_CONTENT_IMAGE_FULLTEXT_CLASS_LABEL" validate="CssIdentifier" showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" /> </fieldset> <fieldset name="category" label="JCATEGORY" description="COM_CONTENT_CONFIG_CATEGORY_SETTINGS_DESC" > <field name="category_layout" type="componentlayout" label="JGLOBAL_FIELD_LAYOUT_LABEL" class="form-select" menuitems="true" extension="com_content" view="category" /> <field name="show_category_title" type="radio" label="JGLOBAL_SHOW_CATEGORY_TITLE" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_description" type="radio" label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_description_image" type="radio" label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="maxLevel" type="list" label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL" default="-1" validate="options" > <option value="0">JNONE</option> <option value="-1">JALL</option> <option value="1">J1</option> <option value="2">J2</option> <option value="3">J3</option> <option value="4">J4</option> <option value="5">J5</option> </field> <field name="show_empty_categories" type="radio" label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_no_articles" type="radio" label="COM_CONTENT_NO_ARTICLES_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_category_heading_title_text" type="radio" label="JGLOBAL_SHOW_SUBCATEGORY_HEADING" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_subcat_desc" type="radio" label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL" default="1" layout="joomla.form.field.radio.switcher" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_cat_num_articles" type="radio" label="COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_cat_tags" type="radio" label="COM_CONTENT_FIELD_SHOW_CAT_TAGS_LABEL" default="1" layout="joomla.form.field.radio.switcher" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="categories" label="JCATEGORIES" description="COM_CONTENT_CONFIG_CATEGORIES_SETTINGS_DESC" > <field name="show_base_description" type="radio" label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="maxLevelcat" type="list" label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL" default="-1" validate="options" > <option value="0">JNONE</option> <option value="-1">JALL</option> <option value="1">J1</option> <option value="2">J2</option> <option value="3">J3</option> <option value="4">J4</option> <option value="5">J5</option> </field> <field name="show_empty_categories_cat" type="radio" label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL" layout="joomla.form.field.radio.switcher" default="0" showon="maxLevelcat:-1,1,2,3,4,5" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_subcat_desc_cat" type="radio" label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL" layout="joomla.form.field.radio.switcher" default="1" showon="maxLevelcat:-1,1,2,3,4,5" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_cat_num_articles_cat" type="radio" label="COM_CONTENT_NUMBER_CATEGORY_ITEMS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="blog_default_parameters" label="COM_CONTENT_CONFIG_BLOG_SETTINGS_LABEL" description="COM_CONTENT_CONFIG_BLOG_SETTINGS_DESC" > <field name="num_leading_articles" type="number" label="JGLOBAL_NUM_LEADING_ARTICLES_LABEL" filter="integer" validate="number" min="0" default="1" /> <field name="blog_class_leading" type="text" label="JGLOBAL_BLOG_CLASS_LEADING" validate="CssIdentifier" /> <field name="num_intro_articles" type="number" label="JGLOBAL_NUM_INTRO_ARTICLES_LABEL" filter="integer" validate="number" min="0" default="4" /> <field name="blog_class" type="text" label="JGLOBAL_BLOG_CLASS" description="JGLOBAL_BLOG_CLASS_NOTE_DESC" validate="CssIdentifier" /> <field name="num_columns" type="number" label="JGLOBAL_NUM_COLUMNS_LABEL" filter="integer" validate="number" min="0" default="1" /> <field name="multi_column_order" type="list" label="JGLOBAL_MULTI_COLUMN_ORDER_LABEL" default="0" validate="options" > <option value="0">JGLOBAL_BLOG_DOWN_OPTION</option> <option value="1">JGLOBAL_BLOG_ACROSS_OPTION</option> </field> <field name="num_links" type="number" label="JGLOBAL_NUM_LINKS_LABEL" filter="integer" validate="number" min="0" default="4" /> <field name="show_subcategory_content" type="list" label="JGLOBAL_SHOW_SUBCATEGORY_CONTENT_LABEL" default="0" validate="options" > <option value="0">JNONE</option> <option value="-1">JALL</option> <option value="1">J1</option> <option value="2">J2</option> <option value="3">J3</option> <option value="4">J4</option> <option value="5">J5</option> </field> <field name="link_intro_image" type="radio" label="JGLOBAL_LINKED_INTRO_IMAGE_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="list_default_parameters" label="JGLOBAL_LIST_LAYOUT_OPTIONS" description="COM_CONTENT_CONFIG_LIST_SETTINGS_DESC" addfieldprefix="Joomla\Component\Content\Administrator\Field" > <field name="show_pagination_limit" type="radio" label="JGLOBAL_DISPLAY_SELECT_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="filter_field" type="list" label="JGLOBAL_FILTER_FIELD_LABEL" default="hide" validate="options" > <option value="hide">JHIDE</option> <option value="title">JGLOBAL_TITLE</option> <option value="author">JAUTHOR</option> <option value="hits" requires="hits">JGLOBAL_HITS</option> <option value="tag">JTAG</option> <option value="month">JMONTH_PUBLISHED</option> </field> <field name="show_headings" type="radio" label="JGLOBAL_SHOW_HEADINGS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="list_show_date" type="list" label="JGLOBAL_SHOW_DATE_LABEL" default="0" validate="options" > <option value="0">JHIDE</option> <option value="created">JGLOBAL_CREATED</option> <option value="modified">JGLOBAL_MODIFIED</option> <option value="published">JPUBLISHED</option> </field> <field name="date_format" type="text" label="JGLOBAL_DATE_FORMAT_LABEL" showon="list_show_date:created,modified,published" /> <field name="list_show_hits" type="radio" label="JGLOBAL_LIST_HITS_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="list_show_author" type="radio" label="JGLOBAL_LIST_AUTHOR_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="display_num" type="list" label="JGLOBAL_NUMBER_ITEMS_LIST_LABEL" default="10" validate="options" > <option value="5">J5</option> <option value="10">J10</option> <option value="15">J15</option> <option value="20">J20</option> <option value="25">J25</option> <option value="30">J30</option> <option value="50">J50</option> <option value="100">J100</option> <option value="0">JALL</option> </field> <field name="list_show_votes" type="voteradio" label="JGLOBAL_LIST_VOTES_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="list_show_ratings" type="voteradio" label="JGLOBAL_LIST_RATINGS_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="shared" label="COM_CONTENT_SHARED_LABEL" description="COM_CONTENT_SHARED_DESC" > <field name="orderby_pri" type="list" label="JGLOBAL_CATEGORY_ORDER_LABEL" default="none" validate="options" > <option value="none">JGLOBAL_NO_ORDER</option> <option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option> <option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option> <option value="order">JGLOBAL_CATEGORY_MANAGER_ORDER</option> </field> <field name="orderby_sec" type="list" label="JGLOBAL_ARTICLE_ORDER_LABEL" default="rdate" validate="options" > <option value="rdate">JGLOBAL_MOST_RECENT_FIRST</option> <option value="date">JGLOBAL_OLDEST_FIRST</option> <option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option> <option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option> <option value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option> <option value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option> <option value="hits" requires="hits">JGLOBAL_MOST_HITS</option> <option value="rhits" requires="hits">JGLOBAL_LEAST_HITS</option> <option value="order">JGLOBAL_ARTICLE_MANAGER_ORDER</option> <option value="rorder">JGLOBAL_ARTICLE_MANAGER_REVERSE_ORDER</option> <option value="vote" requires="vote">JGLOBAL_VOTES_DESC</option> <option value="rvote" requires="vote">JGLOBAL_VOTES_ASC</option> <option value="rank" requires="vote">JGLOBAL_RATINGS_DESC</option> <option value="rrank" requires="vote">JGLOBAL_RATINGS_ASC</option> </field> <field name="order_date" type="list" label="JGLOBAL_ORDERING_DATE_LABEL" default="published" validate="options" > <option value="created">JGLOBAL_CREATED</option> <option value="modified">JGLOBAL_MODIFIED</option> <option value="published">JPUBLISHED</option> </field> <field name="show_pagination" type="list" label="JGLOBAL_PAGINATION_LABEL" default="2" validate="options" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> <option value="2">JGLOBAL_AUTO</option> </field> <field name="show_pagination_results" type="radio" label="JGLOBAL_PAGINATION_RESULTS_LABEL" layout="joomla.form.field.radio.switcher" default="1" showon="show_pagination:1,2" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="show_featured" type="list" label="JGLOBAL_SHOW_FEATURED_ARTICLES_LABEL" default="show" validate="options" > <option value="show">JSHOW</option> <option value="hide">JHIDE</option> <option value="only">JONLY</option> </field> </fieldset> <fieldset name="integration" label="JGLOBAL_INTEGRATION_LABEL" description="COM_CONTENT_CONFIG_INTEGRATION_SETTINGS_DESC" > <fieldset name="integration_newsfeed" label="JGLOBAL_FEED_TITLE" > <field name="show_feed_link" type="radio" label="JGLOBAL_SHOW_FEED_LINK_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="feed_summary" type="list" label="JGLOBAL_FEED_SUMMARY_LABEL" default="0" showon="show_feed_link:1" validate="options" > <option value="0">JGLOBAL_INTRO_TEXT</option> <option value="1">JGLOBAL_FULL_TEXT</option> </field> <field name="feed_show_readmore" type="radio" label="JGLOBAL_FEED_SHOW_READMORE_LABEL" description="JGLOBAL_FEED_SHOW_READMORE_DESC" layout="joomla.form.field.radio.switcher" default="0" showon="show_feed_link:1[AND]feed_summary:0" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> <fieldset name="integration_sef" label="JGLOBAL_SEF_TITLE" > <field name="sef_ids" type="radio" layout="joomla.form.field.radio.switcher" default="0" label="JGLOBAL_SEF_NOIDS_LABEL" filter="integer" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="integration_customfields" label="JGLOBAL_FIELDS_TITLE" > <field name="custom_fields_enable" type="radio" label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL" layout="joomla.form.field.radio.switcher" default="1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="integration_workflows" label="JWORKFLOW_TITLE" > <field name="workflow_enabled" type="radio" label="JWORKFLOW_ENABLED_LABEL" layout="joomla.form.field.radio.switcher" default="0" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> </fieldset> <fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC" > <field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" validate="rules" filter="rules" component="com_content" section="component" /> </fieldset> </config> presets/content.xml 0000644 00000005213 15172746405 0010441 0 ustar 00 <?xml version="1.0"?> <menu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:joomla.org" xsi:schemaLocation="urn:joomla.org menu.xsd" > <menuitem title="COM_CONTENT_MENUS" type="heading" icon="file-alt" class="class:file-alt" > <menuitem title="COM_CONTENT_MENUS_ARTICLE_MANAGER" type="component" element="com_content" link="index.php?option=com_content&view=articles" quicktask="index.php?option=com_content&task=article.add" quicktask-title="COM_CONTENT_MENUS_NEW_ARTICLE" /> <menuitem title="COM_CONTENT_MENUS_CATEGORY_MANAGER" type="component" element="com_categories" link="index.php?option=com_categories&view=categories&extension=com_content" quicktask="index.php?option=com_categories&extension=com_content&task=category.add" quicktask-title="COM_CONTENT_MENUS_NEW_CATEGORY" /> <menuitem title="COM_CONTENT_MENUS_FEATURED" type="component" element="com_content" link="index.php?option=com_content&view=featured" class="class:featured" /> </menuitem> <menuitem title="COM_CONTENT_MENUS_MANAGE" type="heading" icon="cog" class="class:file-alt" > <menuitem title="COM_CONTENT_MENUS_WORKFLOW" type="component" element="com_workflow" link="index.php?option=com_workflow&view=workflows&extension=com_content.article" /> <menuitem title="MOD_MENU_FIELDS" type="component" element="com_fields" link="index.php?option=com_fields&view=fields&context=com_content.article" /> <menuitem title="MOD_MENU_FIELDS_GROUP" type="component" element="com_fields" link="index.php?option=com_fields&view=groups&context=com_content.article" /> </menuitem> <menuitem title="COM_CONTENT_MENUS_MISC" type="heading" icon="cubes" class="class:file-alt" dashboard="content" > <menuitem title="MOD_MENU_MEDIA_MANAGER" type="component" element="com_media" link="index.php?option=com_media" class="class:image" /> <menuitem title="MOD_MENU_EXTENSIONS_MODULE_MANAGER_SITE" type="component" element="com_modules" link="index.php?option=com_modules&view=modules&client_id=0" quicktask="index.php?option=com_modules&view=select&client_id=0" quicktask-title="COM_CONTENT_MENUS_NEW_SITE_MODULE" /> <menuitem title="MOD_MENU_EXTENSIONS_MODULE_MANAGER_ADMINISTRATOR" type="component" element="com_modules" link="index.php?option=com_modules&view=modules&client_id=1" quicktask="index.php?option=com_modules&view=select&client_id=1" quicktask-title="COM_CONTENT_MENUS_NEW_ADMIN_MODULE" /> </menuitem> </menu> tmpl/articles/default_batch_body.php 0000644 00000003660 15172746405 0013661 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Layout\LayoutHelper; $params = ComponentHelper::getParams('com_content'); $published = (int) $this->state->get('filter.published'); $user = Factory::getUser(); ?> <div class="p-3"> <div class="row"> <?php if (Multilanguage::isEnabled()) : ?> <div class="form-group col-md-6"> <div class="controls"> <?php echo LayoutHelper::render('joomla.html.batch.language', []); ?> </div> </div> <?php endif; ?> <div class="form-group col-md-6"> <div class="controls"> <?php echo LayoutHelper::render('joomla.html.batch.access', []); ?> </div> </div> </div> <div class="row"> <?php if ($published >= 0) : ?> <div class="form-group col-md-6"> <div class="controls"> <?php echo LayoutHelper::render('joomla.html.batch.item', ['extension' => 'com_content']); ?> </div> </div> <?php endif; ?> <div class="form-group col-md-6"> <div class="controls"> <?php echo LayoutHelper::render('joomla.html.batch.tag', []); ?> </div> </div> <?php if ($user->authorise('core.admin', 'com_content') && $params->get('workflow_enabled')) : ?> <div class="form-group col-md-6"> <div class="controls"> <?php echo LayoutHelper::render('joomla.html.batch.workflowstage', ['extension' => 'com_content']); ?> </div> </div> <?php endif; ?> </div> </div> tmpl/articles/default.xml 0000644 00000004364 15172746405 0011516 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <metadata> <layout title="COM_CONTENT_ARTICLES_VIEW_DEFAULT_TITLE"> <message> <![CDATA[COM_CONTENT_ARTICLES_VIEW_DEFAULT_DESC]]> </message> </layout> <!-- Add fields to the request variables for the layout. --> <fields name="request"> <fieldset name="request" addfieldprefix="Joomla\Component\Categories\Administrator\Field" > <field name="filter_category_id" type="modal_category" label="COM_MENUS_ADMIN_CATEGORY_LABEL" extension="com_content" select="true" new="true" edit="true" clear="true" filter="integer" /> <field name="filter_level" type="integer" label="COM_MENUS_ADMIN_LEVEL_LABEL" first="1" last="10" step="1" languages="*" filter="integer" > <option value="">JOPTION_SELECT_MAX_LEVELS</option> </field> <field name="filter_author_id" type="author" label="COM_MENUS_ADMIN_AUTHOR_LABEL" multiple="true" layout="joomla.form.field.list-fancy-select" class="multipleAuthors" filter="array" > <option value="0">JNONE</option> <option value="by_me">COM_CONTENT_FILTER_AUTHORS_BY_ME</option> </field> <field name="filter_tag" type="tag" label="COM_MENUS_ADMIN_TAGS_LABEL" multiple="true" filter="intarray" mode="nested" /> <field name="filter_access" type="accesslevel" label="COM_MENUS_ADMIN_ACCESS_LABEL" multiple="true" layout="joomla.form.field.list-fancy-select" filter="intarray" validate="options" /> <field name="filter_language" type="contentlanguage" label="COM_MENUS_ADMIN_LANGUAGE_LABEL" > <option value="">JOPTION_SELECT_LANGUAGE</option> <option value="*">JALL</option> </field> </fieldset> </fields> <fields name="params"> <fieldset name="basic"> <field name="menu-quicktask" type="radio" label="MOD_MENU_FIELD_SHOWNEW" layout="joomla.form.field.radio.switcher" > <option value="">JHIDE</option> <option value="index.php?option=com_content&task=article.add">JSHOW</option> </field> <field name="menu-quicktask-title" type="hidden" default="COM_CONTENT_MENUS_NEW_ARTICLE" /> </fieldset> </fields> </metadata> tmpl/articles/default.php 0000644 00000063315 15172746405 0011506 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Button\FeaturedButton; use Joomla\CMS\Button\PublishedButton; use Joomla\CMS\Button\TransitionButton; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Session\Session; use Joomla\Component\Content\Administrator\Helper\ContentHelper; use Joomla\Utilities\ArrayHelper; /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->useScript('table.columns') ->useScript('multiselect'); $app = Factory::getApplication(); $user = Factory::getUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'a.ordering'; if (strpos($listOrder, 'publish_up') !== false) { $orderingColumn = 'publish_up'; } elseif (strpos($listOrder, 'publish_down') !== false) { $orderingColumn = 'publish_down'; } elseif (strpos($listOrder, 'modified') !== false) { $orderingColumn = 'modified'; } else { $orderingColumn = 'created'; } if ($saveOrder && !empty($this->items)) { $saveOrderingUrl = 'index.php?option=com_content&task=articles.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1'; HTMLHelper::_('draggablelist.draggable'); } $workflow_enabled = ComponentHelper::getParams('com_content')->get('workflow_enabled'); $workflow_state = false; $workflow_featured = false; if ($workflow_enabled) : $wa->getRegistry()->addExtensionRegistryFile('com_workflow'); $wa->useScript('com_workflow.admin-items-workflow-buttons') ->useScript('com_content.articles-status'); $workflow_state = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.state', 'com_content.article'); $workflow_featured = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.featured', 'com_content.article'); endif; $assoc = Associations::isEnabled(); ?> <form action="<?php echo Route::_('index.php?option=com_content&view=articles'); ?>" method="post" name="adminForm" id="adminForm"> <div class="row"> <div class="col-md-12"> <div id="j-main-container" class="j-main-container"> <?php // Search tools bar echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?> <?php if (empty($this->items)) : ?> <div class="alert alert-info"> <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span> <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div> <?php else : ?> <table class="table itemList" id="articleList"> <caption class="visually-hidden"> <?php echo Text::_('COM_CONTENT_ARTICLES_TABLE_CAPTION'); ?>, <span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>, <span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span> </caption> <thead> <tr> <td class="w-1 text-center"> <?php echo HTMLHelper::_('grid.checkall'); ?> </td> <th scope="col" class="w-1 text-center d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?> </th> <?php if ($workflow_enabled) : ?> <th scope="col" class="w-1 text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JSTAGE', 'ws.title', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-1 text-center d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JFEATURED', 'a.featured', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-1 text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?> </th> <th scope="col" style="min-width:100px"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-10 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-10 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JAUTHOR', 'a.created_by', $listDirn, $listOrder); ?> </th> <?php if ($assoc) : ?> <th scope="col" class="w-5 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'COM_CONTENT_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?> </th> <?php endif; ?> <?php if (Multilanguage::isEnabled()) : ?> <th scope="col" class="w-10 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-10 d-none d-md-table-cell text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'COM_CONTENT_HEADING_DATE_' . strtoupper($orderingColumn), 'a.' . $orderingColumn, $listDirn, $listOrder); ?> </th> <?php if ($this->hits) : ?> <th scope="col" class="w-3 d-none d-lg-table-cell text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?> </th> <?php endif; ?> <?php if ($this->vote) : ?> <th scope="col" class="w-3 d-none d-md-table-cell text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_VOTES', 'rating_count', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-3 d-none d-md-table-cell text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_RATINGS', 'rating', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-3 d-none d-lg-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?> </th> </tr> </thead> <tbody<?php if ($saveOrder) : ?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true"<?php endif; ?>> <?php foreach ($this->items as $i => $item) : $item->max_ordering = 0; $canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out); $canEditOwn = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId; $canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin; $canExecuteTransition = $user->authorise('core.execute.transition', 'com_content.article.' . $item->id); $canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid); $canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId; $canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id); $canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId; // Transition button options $options = [ 'title' => Text::_($item->stage_title), 'tip_content' => Text::sprintf('JWORKFLOW', Text::_($item->workflow_title)), 'id' => 'workflow-' . $item->id, 'task' => 'articles.runTransition', 'disabled' => !$canExecuteTransition, ]; if ($canExecuteTransition) { $transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id); $transition_ids = ArrayHelper::getColumn($transitions, 'value'); $transition_ids = ArrayHelper::toInteger($transition_ids); $dataTransitionsAttribute = 'data-transitions="' . implode(',', $transition_ids) . '"'; $options = array_merge($options, ['transitions' => $transitions]); } ?> <tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->catid; ?>" <?php echo $dataTransitionsAttribute ?? '' ?> > <td class="text-center"> <?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?> </td> <td class="text-center d-none d-md-table-cell"> <?php $iconClass = ''; if (!$canChange) { $iconClass = ' inactive'; } elseif (!$saveOrder) { $iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED'); } ?> <span class="sortable-handler<?php echo $iconClass ?>"> <span class="icon-ellipsis-v" aria-hidden="true"></span> </span> <?php if ($canChange && $saveOrder) : ?> <input type="text" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order hidden"> <?php endif; ?> </td> <?php if ($workflow_enabled) : ?> <td class="article-stage text-center"> <?php echo (new TransitionButton($options)) ->render(0, $i); ?> <div class="small"> <?php echo Text::_($item->stage_title); ?> </div> </td> <?php endif; ?> <td class="text-center d-none d-md-table-cell"> <?php $options = [ 'task_prefix' => 'articles.', 'disabled' => $workflow_featured || !$canChange, 'id' => 'featured-' . $item->id ]; echo (new FeaturedButton()) ->render((int) $item->featured, $i, $options, $item->featured_up, $item->featured_down); ?> </td> <td class="article-status text-center"> <?php $options = [ 'task_prefix' => 'articles.', 'disabled' => $workflow_state || !$canChange, 'id' => 'state-' . $item->id, 'category_published' => $item->category_published ]; echo (new PublishedButton())->render((int) $item->state, $i, $options, $item->publish_up, $item->publish_down); ?> </td> <th scope="row" class="has-context"> <div class="break-word"> <?php if ($item->checked_out) : ?> <?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'articles.', $canCheckin); ?> <?php endif; ?> <?php if ($canEdit || $canEditOwn) : ?> <a href="<?php echo Route::_('index.php?option=com_content&task=article.edit&id=' . $item->id); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>"> <?php echo $this->escape($item->title); ?></a> <?php else : ?> <span title="<?php echo Text::sprintf('JFIELD_ALIAS_LABEL', $this->escape($item->alias)); ?>"><?php echo $this->escape($item->title); ?></span> <?php endif; ?> <div class="small break-word"> <?php if (empty($item->note)) : ?> <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?> <?php else : ?> <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?> <?php endif; ?> </div> <div class="small"> <?php $ParentCatUrl = Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->parent_category_id . '&extension=com_content'); $CurrentCatUrl = Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->catid . '&extension=com_content'); $EditCatTxt = Text::_('COM_CONTENT_EDIT_CATEGORY'); echo Text::_('JCATEGORY') . ': '; if ($item->category_level != '1') : if ($item->parent_category_level != '1') : echo ' » '; endif; endif; if ($this->getLanguage()->isRtl()) { if ($canEditCat || $canEditOwnCat) : echo '<a href="' . $CurrentCatUrl . '" title="' . $EditCatTxt . '">'; endif; echo $this->escape($item->category_title); if ($canEditCat || $canEditOwnCat) : echo '</a>'; endif; if ($item->category_level != '1') : echo ' « '; if ($canEditParCat || $canEditOwnParCat) : echo '<a href="' . $ParentCatUrl . '" title="' . $EditCatTxt . '">'; endif; echo $this->escape($item->parent_category_title); if ($canEditParCat || $canEditOwnParCat) : echo '</a>'; endif; endif; } else { if ($item->category_level != '1') : if ($canEditParCat || $canEditOwnParCat) : echo '<a href="' . $ParentCatUrl . '" title="' . $EditCatTxt . '">'; endif; echo $this->escape($item->parent_category_title); if ($canEditParCat || $canEditOwnParCat) : echo '</a>'; endif; echo ' » '; endif; if ($canEditCat || $canEditOwnCat) : echo '<a href="' . $CurrentCatUrl . '" title="' . $EditCatTxt . '">'; endif; echo $this->escape($item->category_title); if ($canEditCat || $canEditOwnCat) : echo '</a>'; endif; } if ($item->category_published < '1') : echo $item->category_published == '0' ? ' (' . Text::_('JUNPUBLISHED') . ')' : ' (' . Text::_('JTRASHED') . ')'; endif; ?> </div> </div> </th> <td class="small d-none d-md-table-cell"> <?php echo $this->escape($item->access_level); ?> </td> <td class="small d-none d-md-table-cell"> <?php if ((int) $item->created_by != 0) : ?> <a href="<?php echo Route::_('index.php?option=com_users&task=user.edit&id=' . (int) $item->created_by); ?>"> <?php echo $this->escape($item->author_name); ?> </a> <?php else : ?> <?php echo Text::_('JNONE'); ?> <?php endif; ?> <?php if ($item->created_by_alias) : ?> <div class="smallsub"><?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->created_by_alias)); ?></div> <?php endif; ?> </td> <?php if ($assoc) : ?> <td class="d-none d-md-table-cell"> <?php if ($item->association) : ?> <?php echo HTMLHelper::_('contentadministrator.association', $item->id); ?> <?php endif; ?> </td> <?php endif; ?> <?php if (Multilanguage::isEnabled()) : ?> <td class="small d-none d-md-table-cell"> <?php echo LayoutHelper::render('joomla.content.language', $item); ?> </td> <?php endif; ?> <td class="small d-none d-md-table-cell text-center"> <?php $date = $item->{$orderingColumn}; echo $date > 0 ? HTMLHelper::_('date', $date, Text::_('DATE_FORMAT_LC4')) : '-'; ?> </td> <?php if ($this->hits) : ?> <td class="d-none d-lg-table-cell text-center"> <span class="badge bg-info"> <?php echo (int) $item->hits; ?> </span> </td> <?php endif; ?> <?php if ($this->vote) : ?> <td class="d-none d-md-table-cell text-center"> <span class="badge bg-success"> <?php echo (int) $item->rating_count; ?> </span> </td> <td class="d-none d-md-table-cell text-center"> <span class="badge bg-warning text-dark"> <?php echo (int) $item->rating; ?> </span> </td> <?php endif; ?> <td class="d-none d-lg-table-cell"> <?php echo (int) $item->id; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php // load the pagination. ?> <?php echo $this->pagination->getListFooter(); ?> <?php // Load the batch processing form. ?> <?php if ( $user->authorise('core.create', 'com_content') && $user->authorise('core.edit', 'com_content') && $user->authorise('core.edit.state', 'com_content') ) : ?> <?php echo HTMLHelper::_( 'bootstrap.renderModal', 'collapseModal', [ 'title' => Text::_('COM_CONTENT_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer'), ], $this->loadTemplate('batch_body') ); ?> <?php endif; ?> <?php endif; ?> <?php if ($workflow_enabled) : ?> <input type="hidden" name="transition_id" value=""> <?php endif; ?> <input type="hidden" name="task" value=""> <input type="hidden" name="boxchecked" value="0"> <?php echo HTMLHelper::_('form.token'); ?> </div> </div> </div> </form> tmpl/articles/emptystate.php 0000644 00000001617 15172746405 0012256 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Layout\LayoutHelper; $displayData = [ 'textPrefix' => 'COM_CONTENT', 'formURL' => 'index.php?option=com_content&view=articles', 'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Adding_a_new_article', 'icon' => 'icon-copy article', ]; $user = Factory::getApplication()->getIdentity(); if ($user->authorise('core.create', 'com_content') || count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) { $displayData['createURL'] = 'index.php?option=com_content&task=article.add'; } echo LayoutHelper::render('joomla.content.emptystate', $displayData); tmpl/articles/modal.php 0000644 00000020223 15172746405 0011145 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Session\Session; use Joomla\Component\Content\Site\Helper\RouteHelper; $app = Factory::getApplication(); if ($app->isClient('site')) { Session::checkToken('get') or die(Text::_('JINVALID_TOKEN')); } /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->useScript('core') ->useScript('multiselect') ->useScript('com_content.admin-articles-modal'); $function = $app->getInput()->getCmd('function', 'jSelectArticle'); $editor = $app->getInput()->getCmd('editor', ''); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $onclick = $this->escape($function); $multilang = Multilanguage::isEnabled(); if (!empty($editor)) { // This view is used also in com_menus. Load the xtd script only if the editor is set! $this->document->addScriptOptions('xtd-articles', ['editor' => $editor]); $onclick = "jSelectArticle"; } ?> <div class="container-popup"> <form action="<?php echo Route::_('index.php?option=com_content&view=articles&layout=modal&tmpl=component&function=' . $function . '&' . Session::getFormToken() . '=1&editor=' . $editor); ?>" method="post" name="adminForm" id="adminForm"> <?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?> <?php if (empty($this->items)) : ?> <div class="alert alert-info"> <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span> <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div> <?php else : ?> <table class="table table-sm"> <caption class="visually-hidden"> <?php echo Text::_('COM_CONTENT_ARTICLES_TABLE_CAPTION'); ?>, <span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>, <span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span> </caption> <thead> <tr> <th scope="col" class="w-1 text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?> </th> <th scope="col" class="title"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-10 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?> </th> <?php if ($multilang) : ?> <th scope="col" class="w-15"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-10 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JDATE', 'a.created', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-1 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?> </th> </tr> </thead> <tbody> <?php $iconStates = [ -2 => 'icon-trash', 0 => 'icon-unpublish', 1 => 'icon-publish', 2 => 'icon-archive', ]; ?> <?php foreach ($this->items as $i => $item) : ?> <?php if ($item->language && $multilang) { $tag = strlen($item->language); if ($tag == 5) { $lang = substr($item->language, 0, 2); } elseif ($tag == 6) { $lang = substr($item->language, 0, 3); } else { $lang = ''; } } elseif (!$multilang) { $lang = ''; } ?> <tr class="row<?php echo $i % 2; ?>"> <td class="text-center"> <span class="tbody-icon"> <span class="<?php echo $iconStates[$this->escape($item->state)]; ?>" aria-hidden="true"></span> </span> </td> <th scope="row"> <?php $attribs = 'data-function="' . $this->escape($onclick) . '"' . ' data-id="' . $item->id . '"' . ' data-title="' . $this->escape($item->title) . '"' . ' data-cat-id="' . $this->escape($item->catid) . '"' . ' data-uri="' . $this->escape(RouteHelper::getArticleRoute($item->id, $item->catid, $item->language)) . '"' . ' data-language="' . $this->escape($lang) . '"'; ?> <a class="select-link" href="javascript:void(0)" <?php echo $attribs; ?>> <?php echo $this->escape($item->title); ?> </a> <div class="small break-word"> <?php if (empty($item->note)) : ?> <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?> <?php else : ?> <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?> <?php endif; ?> </div> <div class="small"> <?php echo Text::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?> </div> </th> <td class="small d-none d-md-table-cell"> <?php echo $this->escape($item->access_level); ?> </td> <?php if ($multilang) : ?> <td class="small"> <?php echo LayoutHelper::render('joomla.content.language', $item); ?> </td> <?php endif; ?> <td class="small d-none d-md-table-cell"> <?php echo HTMLHelper::_('date', $item->created, Text::_('DATE_FORMAT_LC4')); ?> </td> <td class="small d-none d-md-table-cell"> <?php echo (int) $item->id; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php // load the pagination. ?> <?php echo $this->pagination->getListFooter(); ?> <?php endif; ?> <input type="hidden" name="task" value=""> <input type="hidden" name="boxchecked" value="0"> <input type="hidden" name="forcedLanguage" value="<?php echo $app->getInput()->get('forcedLanguage', '', 'CMD'); ?>"> <?php echo HTMLHelper::_('form.token'); ?> </form> </div> tmpl/articles/default_batch_footer.php 0000644 00000001345 15172746405 0014220 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Language\Text; /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->useScript('com_content.admin-articles-batch'); ?> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> <?php echo Text::_('JCANCEL'); ?> </button> <button type="submit" id='batch-submit-button-id' class="btn btn-success" data-submit-task='article.batch'> <?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?> </button> tmpl/article/modal.php 0000644 00000000601 15172746405 0010760 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; ?> <div class="container-popup"> <?php $this->setLayout('edit'); ?> <?php echo $this->loadTemplate(); ?> </div> tmpl/article/edit.php 0000644 00000021114 15172746405 0010613 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** @var \Joomla\Component\Content\Administrator\View\Article\HtmlView $this */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\Registry\Registry; /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->getRegistry()->addExtensionRegistryFile('com_contenthistory'); $wa->useScript('keepalive') ->useScript('form.validate') ->useScript('com_contenthistory.admin-history-versions'); $this->configFieldsets = ['editorConfig']; $this->hiddenFieldsets = ['basic-limited']; $fieldsetsInImages = ['image-intro', 'image-full']; $fieldsetsInLinks = ['linka', 'linkb', 'linkc']; $this->ignore_fieldsets = array_merge(['jmetadata', 'item_associations'], $fieldsetsInImages, $fieldsetsInLinks); $this->useCoreUI = true; // Create shortcut to parameters. $params = clone $this->state->get('params'); $params->merge(new Registry($this->item->attribs)); $input = Factory::getApplication()->getInput(); $assoc = Associations::isEnabled(); $showArticleOptions = $params->get('show_article_options', 1); if (!$assoc || !$showArticleOptions) { $this->ignore_fieldsets[] = 'frontendassociations'; } if (!$showArticleOptions) { // Ignore fieldsets inside Options tab $this->ignore_fieldsets = array_merge($this->ignore_fieldsets, ['attribs', 'basic', 'category', 'author', 'date', 'other']); } // In case of modal $isModal = $input->get('layout') === 'modal'; $layout = $isModal ? 'modal' : 'edit'; $tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; ?> <form action="<?php echo Route::_('index.php?option=com_content&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" aria-label="<?php echo Text::_('COM_CONTENT_FORM_TITLE_' . ((int) $this->item->id === 0 ? 'NEW' : 'EDIT'), true); ?>" class="form-validate"> <?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?> <div class="main-card"> <?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'general', 'recall' => true, 'breakpoint' => 768]); ?> <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'general', Text::_('COM_CONTENT_ARTICLE_CONTENT')); ?> <div class="row"> <div class="col-lg-9"> <div> <fieldset class="adminform"> <?php echo $this->form->getLabel('articletext'); ?> <?php echo $this->form->getInput('articletext'); ?> </fieldset> </div> </div> <div class="col-lg-3"> <?php echo LayoutHelper::render('joomla.edit.global', $this); ?> </div> </div> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php // Do not show the images and links options if the edit form is configured not to. ?> <?php if ($params->get('show_urls_images_backend') == 1) : ?> <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'images', Text::_('COM_CONTENT_FIELDSET_URLS_AND_IMAGES')); ?> <div class="row"> <div class="col-12 col-lg-6"> <?php foreach ($fieldsetsInImages as $fieldset) : ?> <fieldset id="fieldset-<?php echo $fieldset; ?>" class="options-form"> <legend><?php echo Text::_($this->form->getFieldsets()[$fieldset]->label); ?></legend> <div> <?php echo $this->form->renderFieldset($fieldset); ?> </div> </fieldset> <?php endforeach; ?> </div> <div class="col-12 col-lg-6"> <?php foreach ($fieldsetsInLinks as $fieldset) : ?> <fieldset id="fieldset-<?php echo $fieldset; ?>" class="options-form"> <legend><?php echo Text::_($this->form->getFieldsets()[$fieldset]->label); ?></legend> <div> <?php echo $this->form->renderFieldset($fieldset); ?> </div> </fieldset> <?php endforeach; ?> </div> </div> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php endif; ?> <?php echo LayoutHelper::render('joomla.edit.params', $this); ?> <?php // Do not show the publishing options if the edit form is configured not to. ?> <?php if ($params->get('show_publishing_options', 1) == 1) : ?> <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'publishing', Text::_('COM_CONTENT_FIELDSET_PUBLISHING')); ?> <div class="row"> <div class="col-12 col-lg-6"> <fieldset id="fieldset-publishingdata" class="options-form"> <legend><?php echo Text::_('JGLOBAL_FIELDSET_PUBLISHING'); ?></legend> <div> <?php echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?> </div> </fieldset> </div> <div class="col-12 col-lg-6"> <fieldset id="fieldset-metadata" class="options-form"> <legend><?php echo Text::_('JGLOBAL_FIELDSET_METADATA_OPTIONS'); ?></legend> <div> <?php echo LayoutHelper::render('joomla.edit.metadata', $this); ?> </div> </fieldset> </div> </div> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php endif; ?> <?php if (!$isModal && $assoc && $params->get('show_associations_edit', 1) == 1) : ?> <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'associations', Text::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?> <fieldset id="fieldset-associations" class="options-form"> <legend><?php echo Text::_('JGLOBAL_FIELDSET_ASSOCIATIONS'); ?></legend> <div> <?php echo LayoutHelper::render('joomla.edit.associations', $this); ?> </div> </fieldset> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php elseif ($isModal && $assoc) : ?> <div class="hidden"><?php echo LayoutHelper::render('joomla.edit.associations', $this); ?></div> <?php endif; ?> <?php if ($this->canDo->get('core.admin') && $params->get('show_configure_edit_options', 1) == 1) : ?> <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'editor', Text::_('COM_CONTENT_SLIDER_EDITOR_CONFIG')); ?> <fieldset id="fieldset-editor" class="options-form"> <legend><?php echo Text::_('COM_CONTENT_SLIDER_EDITOR_CONFIG'); ?></legend> <div class="form-grid"> <?php echo $this->form->renderFieldset('editorConfig'); ?> </div> </fieldset> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php endif; ?> <?php if ($this->canDo->get('core.admin') && $params->get('show_permissions', 1) == 1) : ?> <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'permissions', Text::_('COM_CONTENT_FIELDSET_RULES')); ?> <fieldset id="fieldset-rules" class="options-form"> <legend><?php echo Text::_('COM_CONTENT_FIELDSET_RULES'); ?></legend> <div> <?php echo $this->form->getInput('rules'); ?> </div> </fieldset> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php endif; ?> <?php echo HTMLHelper::_('uitab.endTabSet'); ?> <?php // Creating 'id' hiddenField to cope with com_associations sidebyside loop ?> <?php if ($params->get('show_publishing_options', 1) == 0) : ?> <?php $hidden_fields = $this->form->getInput('id'); ?> <div class="hidden"><?php echo $hidden_fields; ?></div> <?php endif; ?> <input type="hidden" name="task" value=""> <input type="hidden" name="return" value="<?php echo $input->getBase64('return'); ?>"> <input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>"> <?php echo HTMLHelper::_('form.token'); ?> </div> </form> tmpl/article/edit.xml 0000644 00000000530 15172746405 0010623 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <metadata> <layout title="COM_CONTENT_ARTICLE_VIEW_EDIT_TITLE"> <message> <![CDATA[COM_CONTENT_ARTICLE_VIEW_EDIT_DESC]]> </message> </layout> <fieldset name="request"> <fields name="request"> <field name="id" type="hidden" default="0" /> </fields> </fieldset> </metadata> tmpl/article/pagebreak.php 0000644 00000003133 15172746405 0011610 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->useScript('com_content.admin-article-pagebreak'); $this->eName = Factory::getApplication()->getInput()->getCmd('e_name', ''); $this->eName = preg_replace('#[^A-Z0-9\-\_\[\]]#i', '', $this->eName); $this->document->setTitle(Text::_('COM_CONTENT_PAGEBREAK_DOC_TITLE')); ?> <div class="container-popup"> <form> <div class="control-group"> <div class="control-label"> <label for="title"><?php echo Text::_('COM_CONTENT_PAGEBREAK_TITLE'); ?></label> </div> <div class="controls"> <input class="form-control" type="text" id="title" name="title"> </div> </div> <div class="control-group"> <div class="control-label"> <label for="alias"><?php echo Text::_('COM_CONTENT_PAGEBREAK_TOC'); ?></label> </div> <div class="controls"> <input class="form-control" type="text" id="alt" name="alt"> </div> </div> <button onclick="insertPagebreak('<?php echo $this->eName; ?>');" class="btn btn-success"> <?php echo Text::_('COM_CONTENT_PAGEBREAK_INSERT_BUTTON'); ?> </button> </form> </div> tmpl/featured/default.php 0000644 00000061571 15172746405 0011501 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Button\FeaturedButton; use Joomla\CMS\Button\PublishedButton; use Joomla\CMS\Button\TransitionButton; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Session\Session; use Joomla\Component\Content\Administrator\Helper\ContentHelper; use Joomla\Utilities\ArrayHelper; /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->useScript('table.columns') ->useScript('multiselect'); $app = Factory::getApplication(); $user = Factory::getUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'fp.ordering'; if (strpos($listOrder, 'publish_up') !== false) { $orderingColumn = 'publish_up'; } elseif (strpos($listOrder, 'publish_down') !== false) { $orderingColumn = 'publish_down'; } elseif (strpos($listOrder, 'modified') !== false) { $orderingColumn = 'modified'; } else { $orderingColumn = 'created'; } if ($saveOrder && !empty($this->items)) { $saveOrderingUrl = 'index.php?option=com_content&task=featured.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1'; HTMLHelper::_('draggablelist.draggable'); } $workflow_enabled = ComponentHelper::getParams('com_content')->get('workflow_enabled'); $workflow_state = false; $workflow_featured = false; if ($workflow_enabled) : $wa->getRegistry()->addExtensionRegistryFile('com_workflow'); $wa->useScript('com_workflow.admin-items-workflow-buttons') ->useScript('com_content.articles-status'); $workflow_state = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.state', 'com_content.article'); $workflow_featured = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.featured', 'com_content.article'); endif; $assoc = Associations::isEnabled(); ?> <form action="<?php echo Route::_('index.php?option=com_content&view=featured'); ?>" method="post" name="adminForm" id="adminForm"> <div class="row"> <div class="col-md-12"> <div id="j-main-container" class="j-main-container"> <?php // Search tools bar echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?> <?php if (empty($this->items)) : ?> <div class="alert alert-info"> <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span> <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div> <?php else : ?> <table class="table itemList" id="articleList"> <caption class="visually-hidden"> <?php echo Text::_('COM_CONTENT_FEATURED_TABLE_CAPTION'); ?>, <span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>, <span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span> </caption> <thead> <tr> <td class="w-1 text-center"> <?php echo HTMLHelper::_('grid.checkall'); ?> </td> <th scope="col" class="w-1 text-center d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', '', 'fp.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?> </th> <?php if ($workflow_enabled) : ?> <th scope="col" class="w-1 text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JSTAGE', 'ws.title', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-1 text-center d-none d-md-table-cell"> <?php echo Text::_('JFEATURED'); ?> </th> <th scope="col" class="w-1 text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?> </th> <th scope="col" style="min-width:100px"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-10 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-10 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JAUTHOR', 'a.created_by', $listDirn, $listOrder); ?> </th> <?php if ($assoc) : ?> <th scope="col" class="w-5 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'COM_CONTENT_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?> </th> <?php endif; ?> <?php if (Multilanguage::isEnabled()) : ?> <th scope="col" class="w-10 d-none d-md-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-10 d-none d-md-table-cell text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'COM_CONTENT_HEADING_DATE_' . strtoupper($orderingColumn), 'a.' . $orderingColumn, $listDirn, $listOrder); ?> </th> <?php if ($this->hits) : ?> <th scope="col" class="w-3 d-none d-lg-table-cell text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?> </th> <?php endif; ?> <?php if ($this->vote) : ?> <th scope="col" class="w-3 d-none d-md-table-cell text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_VOTES', 'rating_count', $listDirn, $listOrder); ?> </th> <th scope="col" class="w-3 d-none d-md-table-cell text-center"> <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_RATINGS', 'rating', $listDirn, $listOrder); ?> </th> <?php endif; ?> <th scope="col" class="w-3 d-none d-lg-table-cell"> <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?> </th> </tr> </thead> <tbody<?php if ($saveOrder) : ?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>"<?php endif; ?>> <?php $count = count($this->items); ?> <?php foreach ($this->items as $i => $item) : $item->max_ordering = 0; $ordering = ($listOrder == 'fp.ordering'); $assetId = 'com_content.article.' . $item->id; $canCreate = $user->authorise('core.create', 'com_content.category.' . $item->catid); $canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out); $canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin; $canEditCat = $user->authorise('core.edit', 'com_content.category.' . $item->catid); $canEditOwnCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId; $canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id); $canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId; $transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id); $transition_ids = ArrayHelper::getColumn($transitions, 'value'); $transition_ids = ArrayHelper::toInteger($transition_ids); ?> <tr class="row<?php echo $i % 2; ?>" data-transitions="<?php echo implode(',', $transition_ids); ?>"> <td class="text-center"> <?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?> </td> <td class="text-center d-none d-md-table-cell"> <?php $iconClass = ''; if (!$canChange) { $iconClass = ' inactive'; } elseif (!$saveOrder) { $iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED'); } ?> <span class="sortable-handler<?php echo $iconClass ?>"> <span class="icon-ellipsis-v" aria-hidden="true"></span> </span> <?php if ($canChange && $saveOrder) : ?> <input type="text" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order hidden"> <?php endif; ?> </td> <?php if ($workflow_enabled) : ?> <td class="article-stage text-center"> <?php $options = [ 'transitions' => $transitions, 'title' => Text::_($item->stage_title), 'tip_content' => Text::sprintf('JWORKFLOW', Text::_($item->workflow_title)), 'id' => 'workflow-' . $item->id, 'task' => 'articles.runTransition' ]; echo (new TransitionButton($options)) ->render(0, $i); ?> <div class="small"> <?php echo Text::_($item->stage_title); ?> </div> </td> <?php endif; ?> <td class="text-center d-none d-md-table-cell"> <?php $options = [ 'task_prefix' => 'articles.', 'disabled' => $workflow_featured || !$canChange, 'id' => 'featured-' . $item->id ]; echo (new FeaturedButton()) ->render((int) $item->featured, $i, $options, $item->featured_up, $item->featured_down); ?> </td> <td class="article-status text-center"> <?php $options = [ 'task_prefix' => 'articles.', 'disabled' => $workflow_state || !$canChange, 'id' => 'state-' . $item->id, 'category_published' => $item->category_published ]; echo (new PublishedButton())->render((int) $item->state, $i, $options, $item->publish_up, $item->publish_down); ?> </td> <th scope="row" class="has-context"> <div class="break-word"> <?php if ($item->checked_out) : ?> <?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'articles.', $canCheckin); ?> <?php endif; ?> <?php if ($canEdit) : ?> <a href="<?php echo Route::_('index.php?option=com_content&task=article.edit&return=featured&id=' . $item->id); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>"> <?php echo $this->escape($item->title); ?></a> <?php else : ?> <span title="<?php echo Text::sprintf('JFIELD_ALIAS_LABEL', $this->escape($item->alias)); ?>"><?php echo $this->escape($item->title); ?></span> <?php endif; ?> <div class="small break-word"> <?php if (empty($item->note)) : ?> <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?> <?php else : ?> <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?> <?php endif; ?> </div> <div class="small"> <?php $ParentCatUrl = Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->parent_category_id . '&extension=com_content'); $CurrentCatUrl = Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->catid . '&extension=com_content'); $EditCatTxt = Text::_('COM_CONTENT_EDIT_CATEGORY'); echo Text::_('JCATEGORY') . ': '; if ($item->category_level != '1') : if ($item->parent_category_level != '1') : echo ' » '; endif; endif; if ($this->getLanguage()->isRtl()) { if ($canEditCat || $canEditOwnCat) : echo '<a href="' . $CurrentCatUrl . '" title="' . $EditCatTxt . '">'; endif; echo $this->escape($item->category_title); if ($canEditCat || $canEditOwnCat) : echo '</a>'; endif; if ($item->category_level != '1') : echo ' « '; if ($canEditParCat || $canEditOwnParCat) : echo '<a href="' . $ParentCatUrl . '" title="' . $EditCatTxt . '">'; endif; echo $this->escape($item->parent_category_title); if ($canEditParCat || $canEditOwnParCat) : echo '</a>'; endif; endif; } else { if ($item->category_level != '1') : if ($canEditParCat || $canEditOwnParCat) : echo '<a href="' . $ParentCatUrl . '" title="' . $EditCatTxt . '">'; endif; echo $this->escape($item->parent_category_title); if ($canEditParCat || $canEditOwnParCat) : echo '</a>'; endif; echo ' » '; endif; if ($canEditCat || $canEditOwnCat) : echo '<a href="' . $CurrentCatUrl . '" title="' . $EditCatTxt . '">'; endif; echo $this->escape($item->category_title); if ($canEditCat || $canEditOwnCat) : echo '</a>'; endif; } if ($item->category_published < '1') : echo $item->category_published == '0' ? ' (' . Text::_('JUNPUBLISHED') . ')' : ' (' . Text::_('JTRASHED') . ')'; endif; ?> </div> </div> </th> <td class="small d-none d-md-table-cell"> <?php echo $this->escape($item->access_level); ?> </td> <td class="small d-none d-md-table-cell"> <?php if ((int) $item->created_by != 0) : ?> <a href="<?php echo Route::_('index.php?option=com_users&task=user.edit&id=' . (int) $item->created_by); ?>"> <?php echo $this->escape($item->author_name); ?> </a> <?php else : ?> <?php echo Text::_('JNONE'); ?> <?php endif; ?> <?php if ($item->created_by_alias) : ?> <div class="smallsub"><?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->created_by_alias)); ?></div> <?php endif; ?> </td> <?php if ($assoc) : ?> <td class="d-none d-md-table-cell"> <?php if ($item->association) : ?> <?php echo HTMLHelper::_('contentadministrator.association', $item->id); ?> <?php endif; ?> </td> <?php endif; ?> <?php if (Multilanguage::isEnabled()) : ?> <td class="small d-none d-md-table-cell"> <?php echo LayoutHelper::render('joomla.content.language', $item); ?> </td> <?php endif; ?> <td class="small d-none d-md-table-cell text-center"> <?php $date = $item->{$orderingColumn}; echo $date > 0 ? HTMLHelper::_('date', $date, Text::_('DATE_FORMAT_LC4')) : '-'; ?> </td> <?php if ($this->hits) : ?> <td class="d-none d-lg-table-cell text-center"> <span class="badge bg-info"> <?php echo (int) $item->hits; ?> </span> </td> <?php endif; ?> <?php if ($this->vote) : ?> <td class="d-none d-md-table-cell text-center"> <span class="badge bg-success"> <?php echo (int) $item->rating_count; ?> </span> </td> <td class="d-none d-md-table-cell text-center"> <span class="badge bg-warning text-dark"> <?php echo (int) $item->rating; ?> </span> </td> <?php endif; ?> <td class="d-none d-lg-table-cell"> <?php echo (int) $item->id; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php // load the pagination. ?> <?php echo $this->pagination->getListFooter(); ?> <?php echo HTMLHelper::_( 'bootstrap.renderModal', 'stageModal', [ 'title' => Text::_('JTOOLBAR_CHANGE_STATUS'), 'footer' => $this->loadTemplate('stage_footer'), ], $this->loadTemplate('stage_body') ); ?> <?php endif; ?> <?php if ($workflow_enabled) : ?> <input type="hidden" name="transition_id" value=""> <?php endif; ?> <input type="hidden" name="task" value=""> <input type="hidden" name="featured" value="1"> <input type="hidden" name="boxchecked" value="0"> <?php echo HTMLHelper::_('form.token'); ?> </div> </div> </div> </form> tmpl/featured/default.xml 0000644 00000000322 15172746405 0011475 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <metadata> <layout title="COM_CONTENT_FEATURED_VIEW_DEFAULT_TITLE"> <message> <![CDATA[COM_CONTENT_FEATURED_VIEW_DEFAULT_DESC]]> </message> </layout> </metadata> tmpl/featured/default_stage_footer.php 0000644 00000001330 15172746405 0014225 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Language\Text; /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->useScript('com_content.admin-articles-stage'); ?> <button class="btn btn-secondary" type="button" data-bs-dismiss="modal"> <?php echo Text::_('JCANCEL'); ?> </button> <button id="stage-submit-button-id" class="btn btn-success" type="button" data-submit-task=""> <?php echo Text::_('JGLOBAL_STAGE_PROCESS'); ?> </button> tmpl/featured/default_stage_body.php 0000644 00000001071 15172746405 0013666 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Language\Text; ?> <div class="container"> <div class="row"> <div class="col-12"> <p><?php echo Text::_('COM_CONTENT_CHANGE_STAGE_AMBIGUOUS_TRANSITIONS'); ?></p> </div> <div class="col-12" id="stageModal-content"> </div> </div> </div> tmpl/featured/emptystate.php 0000644 00000001546 15172746405 0012250 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Layout\LayoutHelper; $displayData = [ 'textPrefix' => 'COM_CONTENT', 'formURL' => 'index.php?option=com_content&view=featured', 'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Adding_a_new_article', ]; $user = Factory::getApplication()->getIdentity(); if ($user->authorise('core.create', 'com_content') || count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) { $displayData['createURL'] = 'index.php?option=com_content&task=article.add'; } echo LayoutHelper::render('joomla.content.emptystate', $displayData); services/provider.php 0000644 00000005170 15172746405 0010750 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Association\AssociationExtensionInterface; use Joomla\CMS\Categories\CategoryFactoryInterface; use Joomla\CMS\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; use Joomla\CMS\Extension\ComponentInterface; use Joomla\CMS\Extension\Service\Provider\CategoryFactory; use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory; use Joomla\CMS\Extension\Service\Provider\MVCFactory; use Joomla\CMS\Extension\Service\Provider\RouterFactory; use Joomla\CMS\HTML\Registry; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\Component\Content\Administrator\Extension\ContentComponent; use Joomla\Component\Content\Administrator\Helper\AssociationsHelper; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; /** * The content service provider. * * @since 4.0.0 */ return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.0.0 */ public function register(Container $container) { $container->set(AssociationExtensionInterface::class, new AssociationsHelper()); $container->registerServiceProvider(new CategoryFactory('\\Joomla\\Component\\Content')); $container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Content')); $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Content')); $container->registerServiceProvider(new RouterFactory('\\Joomla\\Component\\Content')); $container->set( ComponentInterface::class, function (Container $container) { $component = new ContentComponent($container->get(ComponentDispatcherFactoryInterface::class)); $component->setRegistry($container->get(Registry::class)); $component->setMVCFactory($container->get(MVCFactoryInterface::class)); $component->setCategoryFactory($container->get(CategoryFactoryInterface::class)); $component->setAssociationExtension($container->get(AssociationExtensionInterface::class)); $component->setRouterFactory($container->get(RouterFactoryInterface::class)); return $component; } ); } }; src/Table/FeaturedTable.php 0000644 00000001471 15172746405 0011620 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Table; use Joomla\CMS\Table\Table; use Joomla\Database\DatabaseDriver; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Featured Table class. * * @since 1.6 */ class FeaturedTable extends Table { /** * Constructor * * @param DatabaseDriver $db Database connector object * * @since 1.6 */ public function __construct(DatabaseDriver $db) { parent::__construct('#__content_frontpage', 'content_id', $db); } } src/Table/ArticleTable.php 0000644 00000000777 15172746405 0011454 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Table; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Article table * * @since 1.5 */ class ArticleTable extends \Joomla\CMS\Table\Content { } src/Helper/AssociationsHelper.php 0000644 00000012050 15172746405 0013073 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Helper; use Joomla\CMS\Association\AssociationExtensionHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Table\Table; use Joomla\Component\Content\Site\Helper\AssociationHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Content associations helper. * * @since 3.7.0 */ class AssociationsHelper extends AssociationExtensionHelper { /** * The extension name * * @var array $extension * * @since 3.7.0 */ protected $extension = 'com_content'; /** * Array of item types * * @var array $itemTypes * * @since 3.7.0 */ protected $itemTypes = ['article', 'category']; /** * Has the extension association support * * @var boolean $associationsSupport * * @since 3.7.0 */ protected $associationsSupport = true; /** * Method to get the associations for a given item. * * @param integer $id Id of the item * @param string $view Name of the view * * @return array Array of associations for the item * * @since 4.0.0 */ public function getAssociationsForItem($id = 0, $view = null) { return AssociationHelper::getAssociations($id, $view); } /** * Get the associated items for an item * * @param string $typeName The item type * @param int $id The id of item for which we need the associated items * * @return array * * @since 3.7.0 */ public function getAssociations($typeName, $id) { $type = $this->getType($typeName); $context = $this->extension . '.item'; $catidField = 'catid'; if ($typeName === 'category') { $context = 'com_categories.item'; $catidField = ''; } // Get the associations. $associations = Associations::getAssociations( $this->extension, $type['tables']['a'], $context, $id, 'id', 'alias', $catidField ); return $associations; } /** * Get item information * * @param string $typeName The item type * @param int $id The id of item for which we need the associated items * * @return Table|null * * @since 3.7.0 */ public function getItem($typeName, $id) { if (empty($id)) { return null; } $table = null; switch ($typeName) { case 'article': $table = Table::getInstance('Content'); break; case 'category': $table = Table::getInstance('Category'); break; } if (is_null($table)) { return null; } $table->load($id); return $table; } /** * Get information about the type * * @param string $typeName The item type * * @return array Array of item types * * @since 3.7.0 */ public function getType($typeName = '') { $fields = $this->getFieldsTemplate(); $tables = []; $joins = []; $support = $this->getSupportTemplate(); $title = ''; if (in_array($typeName, $this->itemTypes)) { switch ($typeName) { case 'article': $support['state'] = true; $support['acl'] = true; $support['checkout'] = true; $support['category'] = true; $support['save2copy'] = true; $tables = [ 'a' => '#__content', ]; $title = 'article'; break; case 'category': $fields['created_user_id'] = 'a.created_user_id'; $fields['ordering'] = 'a.lft'; $fields['level'] = 'a.level'; $fields['catid'] = ''; $fields['state'] = 'a.published'; $support['state'] = true; $support['acl'] = true; $support['checkout'] = true; $support['level'] = true; $tables = [ 'a' => '#__categories', ]; $title = 'category'; break; } } return [ 'fields' => $fields, 'support' => $support, 'tables' => $tables, 'joins' => $joins, 'title' => $title, ]; } } src/Helper/ContentHelper.php 0000644 00000013154 15172746405 0012054 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Helper; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Category; use Joomla\CMS\Workflow\WorkflowServiceInterface; use Joomla\Database\ParameterType; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Content component helper. * * @since 1.6 */ class ContentHelper extends \Joomla\CMS\Helper\ContentHelper { /** * Check if state can be deleted * * @param int $id Id of state to delete * * @return boolean * * @since 4.0.0 */ public static function canDeleteState(int $id): bool { $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('id') ->from($db->quoteName('#__content')) ->where($db->quoteName('state') . ' = :id') ->bind(':id', $id, ParameterType::INTEGER); $db->setQuery($query); $states = $db->loadResult(); return empty($states); } /** * Method to filter transitions by given id of state * * @param array $transitions Array of transitions * @param int $pk Id of state * @param int $workflowId Id of the workflow * * @return array * * @since 4.0.0 */ public static function filterTransitions(array $transitions, int $pk, int $workflowId = 0): array { return array_values( array_filter( $transitions, function ($var) use ($pk, $workflowId) { return in_array($var['from_stage_id'], [-1, $pk]) && $workflowId == $var['workflow_id']; } ) ); } /** * Prepares a form * * @param Form $form The form to change * @param array|object $data The form data * * @return void */ public static function onPrepareForm(Form $form, $data) { if ($form->getName() != 'com_categories.categorycom_content') { return; } $db = Factory::getDbo(); $data = (array) $data; // Make workflows translatable Factory::getLanguage()->load('com_workflow', JPATH_ADMINISTRATOR); $form->setFieldAttribute('workflow_id', 'default', 'inherit'); $component = Factory::getApplication()->bootComponent('com_content'); if ( !$component instanceof WorkflowServiceInterface || !$component->isWorkflowActive('com_content.article') ) { $form->removeField('workflow_id', 'params'); return; } $query = $db->getQuery(true); $query->select($db->quoteName('title')) ->from($db->quoteName('#__workflows')) ->where( [ $db->quoteName('default') . ' = 1', $db->quoteName('published') . ' = 1', $db->quoteName('extension') . ' = ' . $db->quote('com_content.article'), ] ); $defaulttitle = $db->setQuery($query)->loadResult(); $option = Text::_('COM_WORKFLOW_INHERIT_WORKFLOW_NEW'); if (!empty($data['id'])) { $category = new Category($db); $categories = $category->getPath((int) $data['id']); // Remove the current category, because we search for inheritance from parent. array_pop($categories); $option = Text::sprintf('COM_WORKFLOW_INHERIT_WORKFLOW', Text::_($defaulttitle)); if (!empty($categories)) { $categories = array_reverse($categories); $query = $db->getQuery(true); $query->select($db->quoteName('title')) ->from($db->quoteName('#__workflows')) ->where( [ $db->quoteName('id') . ' = :workflowId', $db->quoteName('published') . ' = 1', $db->quoteName('extension') . ' = ' . $db->quote('com_content.article'), ] ) ->bind(':workflowId', $workflow_id, ParameterType::INTEGER); $db->setQuery($query); foreach ($categories as $cat) { $cat->params = new Registry($cat->params); $workflow_id = $cat->params->get('workflow_id'); if ($workflow_id == 'inherit') { continue; } elseif ($workflow_id == 'use_default') { break; } elseif ($workflow_id = (int) $workflow_id) { $title = $db->loadResult(); if (!is_null($title)) { $option = Text::sprintf('COM_WORKFLOW_INHERIT_WORKFLOW', Text::_($title)); break; } } } } } $field = $form->getField('workflow_id', 'params'); $field->addOption($option, ['value' => 'inherit']); $field->addOption(Text::sprintf('COM_WORKFLOW_USE_DEFAULT_WORKFLOW', Text::_($defaulttitle)), ['value' => 'use_default']); $field->addOption('- ' . Text::_('COM_CONTENT_WORKFLOWS') . ' -', ['disabled' => 'true']); } } src/Event/Model/FeatureEvent.php 0000644 00000005403 15172746405 0012577 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Event\Model; use Joomla\CMS\Event\AbstractImmutableEvent; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Event class for WebAsset events * * @since 4.0.0 */ class FeatureEvent extends AbstractImmutableEvent { /** * Constructor. * * @param string $name The event name. * @param array $arguments The event arguments. * * @throws \BadMethodCallException * * @since 4.0.0 */ public function __construct($name, array $arguments = []) { if (!isset($arguments['extension'])) { throw new \BadMethodCallException("Argument 'extension' of event $this->name is required but has not been provided"); } if (!isset($arguments['extension']) || !is_string($arguments['extension'])) { throw new \BadMethodCallException("Argument 'extension' of event $this->name is not of type 'string'"); } if (strpos($arguments['extension'], '.') === false) { throw new \BadMethodCallException("Argument 'extension' of event $this->name has wrong format. Valid format: 'component.section'"); } if (!\array_key_exists('extensionName', $arguments) || !\array_key_exists('section', $arguments)) { $parts = explode('.', $arguments['extension']); $arguments['extensionName'] = $arguments['extensionName'] ?? $parts[0]; $arguments['section'] = $arguments['section'] ?? $parts[1]; } if (!isset($arguments['pks']) || !is_array($arguments['pks'])) { throw new \BadMethodCallException("Argument 'pks' of event $this->name is not of type 'array'"); } if (!isset($arguments['value']) || !is_numeric($arguments['value'])) { throw new \BadMethodCallException("Argument 'value' of event $this->name is not of type 'numeric'"); } $arguments['value'] = (int) $arguments['value']; if ($arguments['value'] !== 0 && $arguments['value'] !== 1) { throw new \BadMethodCallException("Argument 'value' of event $this->name is not 0 or 1"); } parent::__construct($name, $arguments); } /** * Set abort and reason parameters. * * @param string $reason Abort reason * * @return void * * @since 4.0.0 */ public function setAbort(string $reason) { $this->arguments['abort'] = true; $this->arguments['abortReason'] = $reason; } } src/Controller/AjaxController.php 0000644 00000005444 15172746405 0013140 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Controller; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\Response\JsonResponse; use Joomla\CMS\Session\Session; use Joomla\CMS\Table\Table; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The article controller for ajax requests * * @since 3.9.0 */ class AjaxController extends BaseController { /** * Method to fetch associations of an article * * The method assumes that the following http parameters are passed in an Ajax Get request: * token: the form token * assocId: the id of the article whose associations are to be returned * excludeLang: the association for this language is to be excluded * * @return null * * @since 3.9.0 */ public function fetchAssociations() { if (!Session::checkToken('get')) { echo new JsonResponse(null, Text::_('JINVALID_TOKEN'), true); } else { $assocId = $this->input->getInt('assocId', 0); if ($assocId == 0) { echo new JsonResponse(null, Text::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', 'assocId'), true); return; } $excludeLang = $this->input->get('excludeLang', '', 'STRING'); $associations = Associations::getAssociations('com_content', '#__content', 'com_content.item', (int) $assocId); unset($associations[$excludeLang]); // Add the title to each of the associated records $contentTable = Table::getInstance('Content', 'JTable'); foreach ($associations as $lang => $association) { $contentTable->load($association->id); $associations[$lang]->title = $contentTable->title; } $countContentLanguages = count(LanguageHelper::getContentLanguages([0, 1], false)); if (count($associations) == 0) { $message = Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_NONE'); } elseif ($countContentLanguages > count($associations) + 2) { $tags = implode(', ', array_keys($associations)); $message = Text::sprintf('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_SOME', $tags); } else { $message = Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_MESSAGE_ALL'); } echo new JsonResponse($associations, $message); } } } src/Controller/ArticleController.php 0000644 00000013333 15172746405 0013634 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Controller; use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\MVC\Controller\FormController; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Router\Route; use Joomla\CMS\Versioning\VersionableControllerTrait; use Joomla\Input\Input; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * The article controller * * @since 1.6 */ class ArticleController extends FormController { use VersionableControllerTrait; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'default_task', 'model_path', and * 'view_path' (this list is not meant to be comprehensive). * @param MVCFactoryInterface $factory The factory. * @param CMSApplication $app The Application for the dispatcher * @param Input $input Input * * @since 3.0 */ public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null) { parent::__construct($config, $factory, $app, $input); // An article edit form can come from the articles or featured view. // Adjust the redirect view on the value of 'return' in the request. if ($this->input->get('return') == 'featured') { $this->view_list = 'featured'; $this->view_item = 'article&return=featured'; } } /** * Function that allows child controller access to model data * after the data has been saved. * * @param BaseDatabaseModel $model The data model object. * @param array $validData The validated data. * * @return void * * @since 4.0.0 */ protected function postSaveHook(BaseDatabaseModel $model, $validData = []) { if ($this->getTask() === 'save2menu') { $editState = []; $id = $model->getState('article.id'); $link = 'index.php?option=com_content&view=article'; $type = 'component'; $editState['id'] = $id; $editState['link'] = $link; $editState['title'] = $model->getItem($id)->title; $editState['type'] = $type; $editState['request']['id'] = $id; $this->app->setUserState('com_menus.edit.item', [ 'data' => $editState, 'type' => $type, 'link' => $link, ]); $this->setRedirect(Route::_('index.php?option=com_menus&view=item&client_id=0&menutype=mainmenu&layout=edit', false)); } } /** * Method override to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 1.6 */ protected function allowAdd($data = []) { $categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int'); if ($categoryId) { // If the category has been passed in the data or URL check it. return $this->app->getIdentity()->authorise('core.create', 'com_content.category.' . $categoryId); } // In the absence of better information, revert to the component permissions. return parent::allowAdd(); } /** * Method override to check if you can edit an existing record. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 1.6 */ protected function allowEdit($data = [], $key = 'id') { $recordId = (int) isset($data[$key]) ? $data[$key] : 0; $user = $this->app->getIdentity(); // Zero record (id:0), return component edit permission by calling parent controller method if (!$recordId) { return parent::allowEdit($data, $key); } // Check edit on the record asset (explicit or inherited) if ($user->authorise('core.edit', 'com_content.article.' . $recordId)) { return true; } // Check edit own on the record asset (explicit or inherited) if ($user->authorise('core.edit.own', 'com_content.article.' . $recordId)) { // Existing record already has an owner, get it $record = $this->getModel()->getItem($recordId); if (empty($record)) { return false; } // Grant if current user is owner of the record return $user->id == $record->created_by; } return false; } /** * Method to run batch operations. * * @param object $model The model. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 1.6 */ public function batch($model = null) { $this->checkToken(); // Set the model /** @var \Joomla\Component\Content\Administrator\Model\ArticleModel $model */ $model = $this->getModel('Article', 'Administrator', []); // Preset the redirect $this->setRedirect(Route::_('index.php?option=com_content&view=articles' . $this->getRedirectToListAppend(), false)); return parent::batch($model); } } src/Controller/ArticlesController.php 0000644 00000011624 15172746405 0014020 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Controller; use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\Response\JsonResponse; use Joomla\CMS\Router\Route; use Joomla\Input\Input; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Articles list controller class. * * @since 1.6 */ class ArticlesController extends AdminController { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'default_task', 'model_path', and * 'view_path' (this list is not meant to be comprehensive). * @param MVCFactoryInterface $factory The factory. * @param CMSApplication $app The Application for the dispatcher * @param Input $input Input * * @since 3.0 */ public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null) { parent::__construct($config, $factory, $app, $input); // Articles default form can come from the articles or featured view. // Adjust the redirect view on the value of 'view' in the request. if ($this->input->get('view') == 'featured') { $this->view_list = 'featured'; } $this->registerTask('unfeatured', 'featured'); } /** * Method to toggle the featured setting of a list of articles. * * @return void * * @since 1.6 */ public function featured() { // Check for request forgeries $this->checkToken(); $user = $this->app->getIdentity(); $ids = (array) $this->input->get('cid', [], 'int'); $values = ['featured' => 1, 'unfeatured' => 0]; $task = $this->getTask(); $value = ArrayHelper::getValue($values, $task, 0, 'int'); $redirectUrl = 'index.php?option=com_content&view=' . $this->view_list . $this->getRedirectToListAppend(); // Access checks. foreach ($ids as $i => $id) { // Remove zero value resulting from input filter if ($id === 0) { unset($ids[$i]); continue; } if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) { // Prune items that you can't change. unset($ids[$i]); $this->app->enqueueMessage(Text::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'notice'); } } if (empty($ids)) { $this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED'), 'error'); $this->setRedirect(Route::_($redirectUrl, false)); return; } // Get the model. /** @var \Joomla\Component\Content\Administrator\Model\ArticleModel $model */ $model = $this->getModel(); // Publish the items. if (!$model->featured($ids, $value)) { $this->setRedirect(Route::_($redirectUrl, false), $model->getError(), 'error'); return; } if ($value == 1) { $message = Text::plural('COM_CONTENT_N_ITEMS_FEATURED', count($ids)); } else { $message = Text::plural('COM_CONTENT_N_ITEMS_UNFEATURED', count($ids)); } $this->setRedirect(Route::_($redirectUrl, false), $message); } /** * Proxy for getModel. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config The array of possible config values. Optional. * * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel * * @since 1.6 */ public function getModel($name = 'Article', $prefix = 'Administrator', $config = ['ignore_request' => true]) { return parent::getModel($name, $prefix, $config); } /** * Method to get the JSON-encoded amount of published articles * * @return void * * @since 4.0.0 */ public function getQuickiconContent() { $model = $this->getModel('articles'); $model->setState('filter.published', 1); $amount = (int) $model->getTotal(); $result = []; $result['amount'] = $amount; $result['sronly'] = Text::plural('COM_CONTENT_N_QUICKICON_SRONLY', $amount); $result['name'] = Text::plural('COM_CONTENT_N_QUICKICON', $amount); echo new JsonResponse($result); } } src/Controller/FeaturedController.php 0000644 00000006572 15172746405 0014017 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Controller; use Joomla\CMS\Language\Text; use Joomla\CMS\Response\JsonResponse; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Featured content controller class. * * @since 1.6 */ class FeaturedController extends ArticlesController { /** * Removes an item. * * @return void * * @since 1.6 */ public function delete() { // Check for request forgeries $this->checkToken(); $user = $this->app->getIdentity(); $ids = (array) $this->input->get('cid', [], 'int'); // Access checks. foreach ($ids as $i => $id) { // Remove zero value resulting from input filter if ($id === 0) { unset($ids[$i]); continue; } if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) { // Prune items that you can't delete. unset($ids[$i]); $this->app->enqueueMessage(Text::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'notice'); } } if (empty($ids)) { $this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED'), 'error'); } else { /** @var \Joomla\Component\Content\Administrator\Model\FeatureModel $model */ $model = $this->getModel(); // Remove the items. if (!$model->featured($ids, 0)) { $this->app->enqueueMessage($model->getError(), 'error'); } } $this->setRedirect('index.php?option=com_content&view=featured'); } /** * Method to publish a list of articles. * * @return void * * @since 1.0 */ public function publish() { parent::publish(); $this->setRedirect('index.php?option=com_content&view=featured'); } /** * Method to get a model object, loading it if required. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model. * * @since 1.6 */ public function getModel($name = 'Feature', $prefix = 'Administrator', $config = ['ignore_request' => true]) { return parent::getModel($name, $prefix, $config); } /** * Method to get the number of published featured articles for quickicons * * @return void * * @since 4.3.0 */ public function getQuickiconContent() { $model = $this->getModel('articles'); $model->setState('filter.published', 1); $model->setState('filter.featured', 1); $amount = (int) $model->getTotal(); $result = []; $result['amount'] = $amount; $result['sronly'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON_SRONLY', $amount); $result['name'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON', $amount); echo new JsonResponse($result); } } src/Controller/DisplayController.php 0000644 00000003617 15172746405 0013662 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Controller; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\Router\Route; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Component Controller * * @since 1.5 */ class DisplayController extends BaseController { /** * The default view. * * @var string * @since 1.6 */ protected $default_view = 'articles'; /** * Method to display a view. * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return BaseController|boolean This object to support chaining. * * @since 1.5 */ public function display($cachable = false, $urlparams = []) { $view = $this->input->get('view', 'articles'); $layout = $this->input->get('layout', 'articles'); $id = $this->input->getInt('id'); // Check for edit form. if ($view == 'article' && $layout == 'edit' && !$this->checkEditId('com_content.edit.article', $id)) { // Somehow the person just went to the form - we don't allow that. if (!\count($this->app->getMessageQueue())) { $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error'); } $this->setRedirect(Route::_('index.php?option=com_content&view=articles', false)); return false; } return parent::display(); } } src/Extension/ContentComponent.php 0000644 00000022736 15172746405 0013342 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Extension; use Joomla\CMS\Association\AssociationServiceInterface; use Joomla\CMS\Association\AssociationServiceTrait; use Joomla\CMS\Categories\CategoryServiceInterface; use Joomla\CMS\Categories\CategoryServiceTrait; use Joomla\CMS\Component\Router\RouterServiceInterface; use Joomla\CMS\Component\Router\RouterServiceTrait; use Joomla\CMS\Extension\BootableExtensionInterface; use Joomla\CMS\Extension\MVCComponent; use Joomla\CMS\Factory; use Joomla\CMS\Fields\FieldsServiceInterface; use Joomla\CMS\Form\Form; use Joomla\CMS\Helper\ContentHelper as LibraryContentHelper; use Joomla\CMS\HTML\HTMLRegistryAwareTrait; use Joomla\CMS\Language\Text; use Joomla\CMS\Tag\TagServiceInterface; use Joomla\CMS\Tag\TagServiceTrait; use Joomla\CMS\Workflow\WorkflowServiceInterface; use Joomla\CMS\Workflow\WorkflowServiceTrait; use Joomla\Component\Content\Administrator\Helper\ContentHelper; use Joomla\Component\Content\Administrator\Service\HTML\AdministratorService; use Joomla\Component\Content\Administrator\Service\HTML\Icon; use Psr\Container\ContainerInterface; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Component class for com_content * * @since 4.0.0 */ class ContentComponent extends MVCComponent implements BootableExtensionInterface, CategoryServiceInterface, FieldsServiceInterface, AssociationServiceInterface, WorkflowServiceInterface, RouterServiceInterface, TagServiceInterface { use AssociationServiceTrait; use RouterServiceTrait; use HTMLRegistryAwareTrait; use WorkflowServiceTrait; use CategoryServiceTrait, TagServiceTrait { CategoryServiceTrait::getTableNameForSection insteadof TagServiceTrait; CategoryServiceTrait::getStateColumnForSection insteadof TagServiceTrait; } /** @var array Supported functionality */ protected $supportedFunctionality = [ 'core.featured' => true, 'core.state' => true, ]; /** * The trashed condition * * @since 4.0.0 */ public const CONDITION_NAMES = [ self::CONDITION_PUBLISHED => 'JPUBLISHED', self::CONDITION_UNPUBLISHED => 'JUNPUBLISHED', self::CONDITION_ARCHIVED => 'JARCHIVED', self::CONDITION_TRASHED => 'JTRASHED', ]; /** * The archived condition * * @since 4.0.0 */ public const CONDITION_ARCHIVED = 2; /** * The published condition * * @since 4.0.0 */ public const CONDITION_PUBLISHED = 1; /** * The unpublished condition * * @since 4.0.0 */ public const CONDITION_UNPUBLISHED = 0; /** * The trashed condition * * @since 4.0.0 */ public const CONDITION_TRASHED = -2; /** * Booting the extension. This is the function to set up the environment of the extension like * registering new class loaders, etc. * * If required, some initial set up can be done from services of the container, eg. * registering HTML services. * * @param ContainerInterface $container The container * * @return void * * @since 4.0.0 */ public function boot(ContainerInterface $container) { $this->getRegistry()->register('contentadministrator', new AdministratorService()); $this->getRegistry()->register('contenticon', new Icon()); // The layout joomla.content.icons does need a general icon service $this->getRegistry()->register('icon', $this->getRegistry()->getService('contenticon')); } /** * Returns a valid section for the given section. If it is not valid then null * is returned. * * @param string $section The section to get the mapping for * @param object $item The item * * @return string|null The new section * * @since 4.0.0 */ public function validateSection($section, $item = null) { if (Factory::getApplication()->isClient('site')) { // On the front end we need to map some sections switch ($section) { // Editing an article case 'form': // Category list view case 'featured': case 'category': $section = 'article'; } } if ($section != 'article') { // We don't know other sections return null; } return $section; } /** * Returns valid contexts * * @return array * * @since 4.0.0 */ public function getContexts(): array { Factory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR); $contexts = [ 'com_content.article' => Text::_('COM_CONTENT'), 'com_content.categories' => Text::_('JCATEGORY'), ]; return $contexts; } /** * Returns valid contexts * * @return array * * @since 4.0.0 */ public function getWorkflowContexts(): array { Factory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR); $contexts = [ 'com_content.article' => Text::_('COM_CONTENT'), ]; return $contexts; } /** * Returns the workflow context based on the given category section * * @param string $section The section * * @return string|null * * @since 4.0.0 */ public function getCategoryWorkflowContext(?string $section = null): string { $context = $this->getWorkflowContexts(); return array_key_first($context); } /** * Returns the table for the count items functions for the given section. * * @param string $section The section * * @return string|null * * @since 4.0.0 */ protected function getTableNameForSection(string $section = null) { return '#__content'; } /** * Returns a table name for the state association * * @param string $section An optional section to separate different areas in the component * * @return string * * @since 4.0.0 */ public function getWorkflowTableBySection(?string $section = null): string { return '#__content'; } /** * Returns the model name, based on the context * * @param string $context The context of the workflow * * @return string */ public function getModelName($context): string { $parts = explode('.', $context); if (count($parts) < 2) { return ''; } array_shift($parts); $modelname = array_shift($parts); if ($modelname === 'article' && Factory::getApplication()->isClient('site')) { return 'Form'; } elseif ($modelname === 'featured' && Factory::getApplication()->isClient('administrator')) { return 'Article'; } return ucfirst($modelname); } /** * Method to filter transitions by given id of state. * * @param array $transitions The Transitions to filter * @param int $pk Id of the state * * @return array * * @since 4.0.0 */ public function filterTransitions(array $transitions, int $pk): array { return ContentHelper::filterTransitions($transitions, $pk); } /** * Adds Count Items for Category Manager. * * @param \stdClass[] $items The category objects * @param string $section The section * * @return void * * @since 4.0.0 */ public function countItems(array $items, string $section) { $config = (object) [ 'related_tbl' => 'content', 'state_col' => 'state', 'group_col' => 'catid', 'relation_type' => 'category_or_group', 'uses_workflows' => true, 'workflows_component' => 'com_content', ]; LibraryContentHelper::countRelations($items, $config); } /** * Adds Count Items for Tag Manager. * * @param \stdClass[] $items The content objects * @param string $extension The name of the active view. * * @return void * * @since 4.0.0 * @throws \Exception */ public function countTagItems(array $items, string $extension) { $parts = explode('.', $extension); $section = count($parts) > 1 ? $parts[1] : null; $config = (object) [ 'related_tbl' => ($section === 'category' ? 'categories' : 'content'), 'state_col' => ($section === 'category' ? 'published' : 'state'), 'group_col' => 'tag_id', 'extension' => $extension, 'relation_type' => 'tag_assigments', ]; LibraryContentHelper::countRelations($items, $config); } /** * Prepares the category form * * @param Form $form The form to prepare * @param array|object $data The form data * * @return void */ public function prepareForm(Form $form, $data) { ContentHelper::onPrepareForm($form, $data); } } src/Model/FeaturedModel.php 0000644 00000005567 15172746405 0011654 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Model; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Methods supporting a list of featured article records. * * @since 1.6 */ class FeaturedModel extends ArticlesModel { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see \Joomla\CMS\MVC\Controller\BaseController * @since 1.6 */ public function __construct($config = []) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'id', 'a.id', 'title', 'a.title', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'created_by_alias', 'a.created_by_alias', 'ordering', 'a.ordering', 'featured_up', 'fp.featured_up', 'featured_down', 'fp.featured_down', 'language', 'a.language', 'hits', 'a.hits', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'fp.ordering', 'published', 'a.published', 'author_id', 'category_id', 'level', 'tag', 'rating_count', 'rating', 'ws.title', ]; } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 3.5 */ protected function populateState($ordering = 'a.title', $direction = 'asc') { parent::populateState($ordering, $direction); // Filter by featured articles. $this->setState('filter.featured', 1); } /** * Build an SQL query to load the list data. * * @return \Joomla\Database\DatabaseQuery * * @since 4.0.0 */ protected function getListQuery() { $query = parent::getListQuery(); $query->select($this->getDatabase()->quoteName('fp.ordering')); return $query; } } src/Model/ArticlesModel.php 0000644 00000063653 15172746405 0011663 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Model; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Table\Table; use Joomla\Component\Content\Administrator\Extension\ContentComponent; use Joomla\Database\ParameterType; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Methods supporting a list of article records. * * @since 1.6 */ class ArticlesModel extends ListModel { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @since 1.6 * @see \Joomla\CMS\MVC\Controller\BaseController */ public function __construct($config = []) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'id', 'a.id', 'title', 'a.title', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', 'access', 'a.access', 'access_level', 'created', 'a.created', 'modified', 'a.modified', 'created_by', 'a.created_by', 'created_by_alias', 'a.created_by_alias', 'ordering', 'a.ordering', 'featured', 'a.featured', 'featured_up', 'fp.featured_up', 'featured_down', 'fp.featured_down', 'language', 'a.language', 'hits', 'a.hits', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'published', 'a.published', 'author_id', 'category_id', 'level', 'tag', 'rating_count', 'rating', 'stage', 'wa.stage_id', 'ws.title', ]; if (Associations::isEnabled()) { $config['filter_fields'][] = 'association'; } } parent::__construct($config); } /** * Get the filter form * * @param array $data data * @param boolean $loadData load current data * * @return \Joomla\CMS\Form\Form|null The Form object or null if the form can't be found * * @since 3.2 */ public function getFilterForm($data = [], $loadData = true) { $form = parent::getFilterForm($data, $loadData); $params = ComponentHelper::getParams('com_content'); if (!$params->get('workflow_enabled')) { $form->removeField('stage', 'filter'); } else { $ordering = $form->getField('fullordering', 'list'); $ordering->addOption('JSTAGE_ASC', ['value' => 'ws.title ASC']); $ordering->addOption('JSTAGE_DESC', ['value' => 'ws.title DESC']); } return $form; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'a.id', $direction = 'desc') { $app = Factory::getApplication(); $input = $app->getInput(); $forcedLanguage = $input->get('forcedLanguage', '', 'cmd'); // Adjust the context to support modal layouts. if ($layout = $input->get('layout')) { $this->context .= '.' . $layout; } // Adjust the context to support forced languages. if ($forcedLanguage) { $this->context .= '.' . $forcedLanguage; } $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $featured = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured', ''); $this->setState('filter.featured', $featured); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $this->setState('filter.published', $published); $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level'); $this->setState('filter.level', $level); $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); $formSubmitted = $input->post->get('form_submitted'); // Gets the value of a user state variable and sets it in the session $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access'); $this->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id'); $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id'); $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', ''); if ($formSubmitted) { $access = $input->post->get('access'); $this->setState('filter.access', $access); $authorId = $input->post->get('author_id'); $this->setState('filter.author_id', $authorId); $categoryId = $input->post->get('category_id'); $this->setState('filter.category_id', $categoryId); $tag = $input->post->get('tag'); $this->setState('filter.tag', $tag); } // List state information. parent::populateState($ordering, $direction); // Force a language if (!empty($forcedLanguage)) { $this->setState('filter.language', $forcedLanguage); $this->setState('filter.forcedLanguage', $forcedLanguage); } } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . serialize($this->getState('filter.access')); $id .= ':' . $this->getState('filter.published'); $id .= ':' . serialize($this->getState('filter.category_id')); $id .= ':' . serialize($this->getState('filter.author_id')); $id .= ':' . $this->getState('filter.language'); $id .= ':' . serialize($this->getState('filter.tag')); return parent::getStoreId($id); } /** * Build an SQL query to load the list data. * * @return \Joomla\Database\DatabaseQuery * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDatabase(); $query = $db->getQuery(true); $user = $this->getCurrentUser(); $params = ComponentHelper::getParams('com_content'); // Select the required fields from the table. $query->select( $this->getState( 'list.select', [ $db->quoteName('a.id'), $db->quoteName('a.asset_id'), $db->quoteName('a.title'), $db->quoteName('a.alias'), $db->quoteName('a.checked_out'), $db->quoteName('a.checked_out_time'), $db->quoteName('a.catid'), $db->quoteName('a.state'), $db->quoteName('a.access'), $db->quoteName('a.created'), $db->quoteName('a.created_by'), $db->quoteName('a.created_by_alias'), $db->quoteName('a.modified'), $db->quoteName('a.ordering'), $db->quoteName('a.featured'), $db->quoteName('a.language'), $db->quoteName('a.hits'), $db->quoteName('a.publish_up'), $db->quoteName('a.publish_down'), $db->quoteName('a.introtext'), $db->quoteName('a.fulltext'), $db->quoteName('a.note'), $db->quoteName('a.images'), $db->quoteName('a.metakey'), $db->quoteName('a.metadesc'), $db->quoteName('a.metadata'), $db->quoteName('a.version'), ] ) ) ->select( [ $db->quoteName('fp.featured_up'), $db->quoteName('fp.featured_down'), $db->quoteName('l.title', 'language_title'), $db->quoteName('l.image', 'language_image'), $db->quoteName('uc.name', 'editor'), $db->quoteName('ag.title', 'access_level'), $db->quoteName('c.title', 'category_title'), $db->quoteName('c.created_user_id', 'category_uid'), $db->quoteName('c.level', 'category_level'), $db->quoteName('c.published', 'category_published'), $db->quoteName('parent.title', 'parent_category_title'), $db->quoteName('parent.id', 'parent_category_id'), $db->quoteName('parent.created_user_id', 'parent_category_uid'), $db->quoteName('parent.level', 'parent_category_level'), $db->quoteName('ua.name', 'author_name'), $db->quoteName('wa.stage_id', 'stage_id'), $db->quoteName('ws.title', 'stage_title'), $db->quoteName('ws.workflow_id', 'workflow_id'), $db->quoteName('w.title', 'workflow_title'), ] ) ->from($db->quoteName('#__content', 'a')) ->where($db->quoteName('wa.extension') . ' = ' . $db->quote('com_content.article')) ->join('LEFT', $db->quoteName('#__languages', 'l'), $db->quoteName('l.lang_code') . ' = ' . $db->quoteName('a.language')) ->join('LEFT', $db->quoteName('#__content_frontpage', 'fp'), $db->quoteName('fp.content_id') . ' = ' . $db->quoteName('a.id')) ->join('LEFT', $db->quoteName('#__users', 'uc'), $db->quoteName('uc.id') . ' = ' . $db->quoteName('a.checked_out')) ->join('LEFT', $db->quoteName('#__viewlevels', 'ag'), $db->quoteName('ag.id') . ' = ' . $db->quoteName('a.access')) ->join('LEFT', $db->quoteName('#__categories', 'c'), $db->quoteName('c.id') . ' = ' . $db->quoteName('a.catid')) ->join('LEFT', $db->quoteName('#__categories', 'parent'), $db->quoteName('parent.id') . ' = ' . $db->quoteName('c.parent_id')) ->join('LEFT', $db->quoteName('#__users', 'ua'), $db->quoteName('ua.id') . ' = ' . $db->quoteName('a.created_by')) ->join('INNER', $db->quoteName('#__workflow_associations', 'wa'), $db->quoteName('wa.item_id') . ' = ' . $db->quoteName('a.id')) ->join('INNER', $db->quoteName('#__workflow_stages', 'ws'), $db->quoteName('ws.id') . ' = ' . $db->quoteName('wa.stage_id')) ->join('INNER', $db->quoteName('#__workflows', 'w'), $db->quoteName('w.id') . ' = ' . $db->quoteName('ws.workflow_id')); if (PluginHelper::isEnabled('content', 'vote')) { $query->select( [ 'COALESCE(NULLIF(ROUND(' . $db->quoteName('v.rating_sum') . ' / ' . $db->quoteName('v.rating_count') . ', 0), 0), 0)' . ' AS ' . $db->quoteName('rating'), 'COALESCE(NULLIF(' . $db->quoteName('v.rating_count') . ', 0), 0) AS ' . $db->quoteName('rating_count'), ] ) ->join('LEFT', $db->quoteName('#__content_rating', 'v'), $db->quoteName('a.id') . ' = ' . $db->quoteName('v.content_id')); } // Join over the associations. if (Associations::isEnabled()) { $subQuery = $db->getQuery(true) ->select('COUNT(' . $db->quoteName('asso1.id') . ') > 1') ->from($db->quoteName('#__associations', 'asso1')) ->join('INNER', $db->quoteName('#__associations', 'asso2'), $db->quoteName('asso1.key') . ' = ' . $db->quoteName('asso2.key')) ->where( [ $db->quoteName('asso1.id') . ' = ' . $db->quoteName('a.id'), $db->quoteName('asso1.context') . ' = ' . $db->quote('com_content.item'), ] ); $query->select('(' . $subQuery . ') AS ' . $db->quoteName('association')); } // Filter by access level. $access = $this->getState('filter.access'); if (is_numeric($access)) { $access = (int) $access; $query->where($db->quoteName('a.access') . ' = :access') ->bind(':access', $access, ParameterType::INTEGER); } elseif (is_array($access)) { $access = ArrayHelper::toInteger($access); $query->whereIn($db->quoteName('a.access'), $access); } // Filter by featured. $featured = (string) $this->getState('filter.featured'); if (\in_array($featured, ['0','1'])) { $featured = (int) $featured; $query->where($db->quoteName('a.featured') . ' = :featured') ->bind(':featured', $featured, ParameterType::INTEGER); } // Filter by access level on categories. if (!$user->authorise('core.admin')) { $groups = $user->getAuthorisedViewLevels(); $query->whereIn($db->quoteName('a.access'), $groups); $query->whereIn($db->quoteName('c.access'), $groups); } // Filter by published state $workflowStage = (string) $this->getState('filter.stage'); if ($params->get('workflow_enabled') && is_numeric($workflowStage)) { $workflowStage = (int) $workflowStage; $query->where($db->quoteName('wa.stage_id') . ' = :stage') ->bind(':stage', $workflowStage, ParameterType::INTEGER); } $published = (string) $this->getState('filter.published'); if ($published !== '*') { if (is_numeric($published)) { $state = (int) $published; $query->where($db->quoteName('a.state') . ' = :state') ->bind(':state', $state, ParameterType::INTEGER); } elseif (!is_numeric($workflowStage)) { $query->whereIn( $db->quoteName('a.state'), [ ContentComponent::CONDITION_PUBLISHED, ContentComponent::CONDITION_UNPUBLISHED, ] ); } } // Filter by categories and by level $categoryId = $this->getState('filter.category_id', []); $level = (int) $this->getState('filter.level'); if (!is_array($categoryId)) { $categoryId = $categoryId ? [$categoryId] : []; } // Case: Using both categories filter and by level filter if (count($categoryId)) { $categoryId = ArrayHelper::toInteger($categoryId); $categoryTable = Table::getInstance('Category', 'JTable'); $subCatItemsWhere = []; foreach ($categoryId as $key => $filter_catid) { $categoryTable->load($filter_catid); // Because values to $query->bind() are passed by reference, using $query->bindArray() here instead to prevent overwriting. $valuesToBind = [$categoryTable->lft, $categoryTable->rgt]; if ($level) { $valuesToBind[] = $level + $categoryTable->level - 1; } // Bind values and get parameter names. $bounded = $query->bindArray($valuesToBind); $categoryWhere = $db->quoteName('c.lft') . ' >= ' . $bounded[0] . ' AND ' . $db->quoteName('c.rgt') . ' <= ' . $bounded[1]; if ($level) { $categoryWhere .= ' AND ' . $db->quoteName('c.level') . ' <= ' . $bounded[2]; } $subCatItemsWhere[] = '(' . $categoryWhere . ')'; } $query->where('(' . implode(' OR ', $subCatItemsWhere) . ')'); } elseif ($level = (int) $level) { // Case: Using only the by level filter $query->where($db->quoteName('c.level') . ' <= :level') ->bind(':level', $level, ParameterType::INTEGER); } // Filter by author $authorId = $this->getState('filter.author_id'); if (is_numeric($authorId)) { $authorId = (int) $authorId; $type = $this->getState('filter.author_id.include', true) ? ' = ' : ' <> '; $query->where($db->quoteName('a.created_by') . $type . ':authorId') ->bind(':authorId', $authorId, ParameterType::INTEGER); } elseif (is_array($authorId)) { // Check to see if by_me is in the array if (\in_array('by_me', $authorId)) { // Replace by_me with the current user id in the array $authorId['by_me'] = $user->id; } $authorId = ArrayHelper::toInteger($authorId); $query->whereIn($db->quoteName('a.created_by'), $authorId); } // Filter by search in title. $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $search = (int) substr($search, 3); $query->where($db->quoteName('a.id') . ' = :search') ->bind(':search', $search, ParameterType::INTEGER); } elseif (stripos($search, 'author:') === 0) { $search = '%' . substr($search, 7) . '%'; $query->where('(' . $db->quoteName('ua.name') . ' LIKE :search1 OR ' . $db->quoteName('ua.username') . ' LIKE :search2)') ->bind([':search1', ':search2'], $search); } elseif (stripos($search, 'content:') === 0) { $search = '%' . substr($search, 8) . '%'; $query->where('(' . $db->quoteName('a.introtext') . ' LIKE :search1 OR ' . $db->quoteName('a.fulltext') . ' LIKE :search2)') ->bind([':search1', ':search2'], $search); } else { $search = '%' . str_replace(' ', '%', trim($search)) . '%'; $query->where( '(' . $db->quoteName('a.title') . ' LIKE :search1 OR ' . $db->quoteName('a.alias') . ' LIKE :search2' . ' OR ' . $db->quoteName('a.note') . ' LIKE :search3)' ) ->bind([':search1', ':search2', ':search3'], $search); } } // Filter on the language. if ($language = $this->getState('filter.language')) { $query->where($db->quoteName('a.language') . ' = :language') ->bind(':language', $language); } // Filter by a single or group of tags. $tag = $this->getState('filter.tag'); // Run simplified query when filtering by one tag. if (\is_array($tag) && \count($tag) === 1) { $tag = $tag[0]; } if ($tag && \is_array($tag)) { $tag = ArrayHelper::toInteger($tag); $subQuery = $db->getQuery(true) ->select('DISTINCT ' . $db->quoteName('content_item_id')) ->from($db->quoteName('#__contentitem_tag_map')) ->where( [ $db->quoteName('tag_id') . ' IN (' . implode(',', $query->bindArray($tag)) . ')', $db->quoteName('type_alias') . ' = ' . $db->quote('com_content.article'), ] ); $query->join( 'INNER', '(' . $subQuery . ') AS ' . $db->quoteName('tagmap'), $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') ); } elseif ($tag = (int) $tag) { $query->join( 'INNER', $db->quoteName('#__contentitem_tag_map', 'tagmap'), $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') ) ->where( [ $db->quoteName('tagmap.tag_id') . ' = :tag', $db->quoteName('tagmap.type_alias') . ' = ' . $db->quote('com_content.article'), ] ) ->bind(':tag', $tag, ParameterType::INTEGER); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); $orderDirn = $this->state->get('list.direction', 'DESC'); if ($orderCol === 'a.ordering' || $orderCol === 'category_title') { $ordering = [ $db->quoteName('c.title') . ' ' . $db->escape($orderDirn), $db->quoteName('a.ordering') . ' ' . $db->escape($orderDirn), ]; } else { $ordering = $db->escape($orderCol) . ' ' . $db->escape($orderDirn); } $query->order($ordering); return $query; } /** * Method to get all transitions at once for all articles * * @return array|boolean * * @since 4.0.0 */ public function getTransitions() { // Get a storage key. $store = $this->getStoreId('getTransitions'); // Try to load the data from internal storage. if (isset($this->cache[$store])) { return $this->cache[$store]; } $db = $this->getDatabase(); $user = $this->getCurrentUser(); $items = $this->getItems(); if ($items === false) { return false; } $stage_ids = ArrayHelper::getColumn($items, 'stage_id'); $stage_ids = ArrayHelper::toInteger($stage_ids); $stage_ids = array_values(array_unique(array_filter($stage_ids))); $workflow_ids = ArrayHelper::getColumn($items, 'workflow_id'); $workflow_ids = ArrayHelper::toInteger($workflow_ids); $workflow_ids = array_values(array_unique(array_filter($workflow_ids))); $this->cache[$store] = []; try { if (count($stage_ids) || count($workflow_ids)) { Factory::getLanguage()->load('com_workflow', JPATH_ADMINISTRATOR); $query = $db->getQuery(true); $query ->select( [ $db->quoteName('t.id', 'value'), $db->quoteName('t.title', 'text'), $db->quoteName('t.from_stage_id'), $db->quoteName('t.to_stage_id'), $db->quoteName('s.id', 'stage_id'), $db->quoteName('s.title', 'stage_title'), $db->quoteName('t.workflow_id'), ] ) ->from($db->quoteName('#__workflow_transitions', 't')) ->innerJoin( $db->quoteName('#__workflow_stages', 's'), $db->quoteName('t.to_stage_id') . ' = ' . $db->quoteName('s.id') ) ->where( [ $db->quoteName('t.published') . ' = 1', $db->quoteName('s.published') . ' = 1', ] ) ->order($db->quoteName('t.ordering')); $where = []; if (count($stage_ids)) { $where[] = $db->quoteName('t.from_stage_id') . ' IN (' . implode(',', $query->bindArray($stage_ids)) . ')'; } if (count($workflow_ids)) { $where[] = '(' . $db->quoteName('t.from_stage_id') . ' = -1 AND ' . $db->quoteName('t.workflow_id') . ' IN (' . implode(',', $query->bindArray($workflow_ids)) . '))'; } $query->where('((' . implode(') OR (', $where) . '))'); $transitions = $db->setQuery($query)->loadAssocList(); foreach ($transitions as $key => $transition) { if (!$user->authorise('core.execute.transition', 'com_content.transition.' . (int) $transition['value'])) { unset($transitions[$key]); } $transitions[$key]['text'] = Text::_($transition['text']); } $this->cache[$store] = $transitions; } } catch (\RuntimeException $e) { $this->setError($e->getMessage()); return false; } return $this->cache[$store]; } /** * Method to get a list of articles. * Overridden to add item type alias. * * @return mixed An array of data items on success, false on failure. * * @since 4.0.0 */ public function getItems() { $items = parent::getItems(); foreach ($items as $item) { $item->typeAlias = 'com_content.article'; if (isset($item->metadata)) { $registry = new Registry($item->metadata); $item->metadata = $registry->toArray(); } } return $items; } } src/Model/FeatureModel.php 0000644 00000002517 15172746405 0011500 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Model; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Feature model. * * @since 1.6 */ class FeatureModel extends ArticleModel { /** * Returns a Table object, always creating it. * * @param string $type The table type to instantiate * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * * @return \Joomla\CMS\Table\Table A database object * * @since 1.6 */ public function getTable($type = 'Featured', $prefix = 'Administrator', $config = []) { return parent::getTable($type, $prefix, $config); } /** * A protected method to get a set of ordering conditions. * * @param object $table A record object. * * @return array An array of conditions to add to ordering queries. * * @since 1.6 */ protected function getReorderConditions($table) { return []; } } src/Model/ArticleModel.php 0000644 00000115066 15172746405 0011474 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Model; use Joomla\CMS\Date\Date; use Joomla\CMS\Event\AbstractEvent; use Joomla\CMS\Factory; use Joomla\CMS\Filter\InputFilter; use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\Form\Form; use Joomla\CMS\Form\FormFactoryInterface; use Joomla\CMS\Helper\TagsHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\AdminModel; use Joomla\CMS\MVC\Model\WorkflowBehaviorTrait; use Joomla\CMS\MVC\Model\WorkflowModelInterface; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\String\PunycodeHelper; use Joomla\CMS\Table\TableInterface; use Joomla\CMS\Tag\TaggableTableInterface; use Joomla\CMS\UCM\UCMType; use Joomla\CMS\Versioning\VersionableModelTrait; use Joomla\CMS\Workflow\Workflow; use Joomla\Component\Categories\Administrator\Helper\CategoriesHelper; use Joomla\Component\Fields\Administrator\Helper\FieldsHelper; use Joomla\Database\ParameterType; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Item Model for an Article. * * @since 1.6 */ class ArticleModel extends AdminModel implements WorkflowModelInterface { use WorkflowBehaviorTrait; use VersionableModelTrait; /** * The prefix to use with controller messages. * * @var string * @since 1.6 */ protected $text_prefix = 'COM_CONTENT'; /** * The type alias for this content type (for example, 'com_content.article'). * * @var string * @since 3.2 */ public $typeAlias = 'com_content.article'; /** * The context used for the associations table * * @var string * @since 3.4.4 */ protected $associationsContext = 'com_content.item'; /** * The event to trigger before changing featured status one or more items. * * @var string * @since 4.0.0 */ protected $event_before_change_featured = null; /** * The event to trigger after changing featured status one or more items. * * @var string * @since 4.0.0 */ protected $event_after_change_featured = null; /** * Constructor. * * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * @param MVCFactoryInterface $factory The factory. * @param FormFactoryInterface $formFactory The form factory. * * @since 1.6 * @throws \Exception */ public function __construct($config = [], MVCFactoryInterface $factory = null, FormFactoryInterface $formFactory = null) { $config['events_map'] = $config['events_map'] ?? []; $config['events_map'] = array_merge( ['featured' => 'content'], $config['events_map'] ); parent::__construct($config, $factory, $formFactory); // Set the featured status change events $this->event_before_change_featured = $config['event_before_change_featured'] ?? $this->event_before_change_featured; $this->event_before_change_featured = $this->event_before_change_featured ?? 'onContentBeforeChangeFeatured'; $this->event_after_change_featured = $config['event_after_change_featured'] ?? $this->event_after_change_featured; $this->event_after_change_featured = $this->event_after_change_featured ?? 'onContentAfterChangeFeatured'; $this->setUpWorkflow('com_content.article'); } /** * Function that can be overridden to do any data cleanup after batch copying data * * @param TableInterface $table The table object containing the newly created item * @param integer $newId The id of the new item * @param integer $oldId The original item id * * @return void * * @since 3.8.12 */ protected function cleanupPostBatchCopy(TableInterface $table, $newId, $oldId) { // Check if the article was featured and update the #__content_frontpage table if ($table->featured == 1) { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select( [ $db->quoteName('featured_up'), $db->quoteName('featured_down'), ] ) ->from($db->quoteName('#__content_frontpage')) ->where($db->quoteName('content_id') . ' = :oldId') ->bind(':oldId', $oldId, ParameterType::INTEGER); $featured = $db->setQuery($query)->loadObject(); if ($featured) { $query = $db->getQuery(true) ->insert($db->quoteName('#__content_frontpage')) ->values(':newId, 0, :featuredUp, :featuredDown') ->bind(':newId', $newId, ParameterType::INTEGER) ->bind(':featuredUp', $featured->featured_up, $featured->featured_up ? ParameterType::STRING : ParameterType::NULL) ->bind(':featuredDown', $featured->featured_down, $featured->featured_down ? ParameterType::STRING : ParameterType::NULL); $db->setQuery($query); $db->execute(); } } $this->workflowCleanupBatchMove($oldId, $newId); $oldItem = $this->getTable(); $oldItem->load($oldId); $fields = FieldsHelper::getFields('com_content.article', $oldItem, true); $fieldsData = []; if (!empty($fields)) { $fieldsData['com_fields'] = []; foreach ($fields as $field) { $fieldsData['com_fields'][$field->name] = $field->rawvalue; } } Factory::getApplication()->triggerEvent('onContentAfterSave', ['com_content.article', &$this->table, false, $fieldsData]); } /** * Batch move categories to a new category. * * @param integer $value The new category ID. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return boolean True on success. * * @since 3.8.6 */ protected function batchMove($value, $pks, $contexts) { if (empty($this->batchSet)) { // Set some needed variables. $this->user = $this->getCurrentUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->contentType = new UCMType(); $this->type = $this->contentType->getTypeByTable($this->tableClassName); } $categoryId = (int) $value; if (!$this->checkCategoryId($categoryId)) { return false; } PluginHelper::importPlugin('system'); // Parent exists so we proceed foreach ($pks as $pk) { if (!$this->user->authorise('core.edit', $contexts[$pk])) { $this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { // Fatal error $this->setError($error); return false; } else { // Not fatal error $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } $fields = FieldsHelper::getFields('com_content.article', $this->table, true); $fieldsData = []; if (!empty($fields)) { $fieldsData['com_fields'] = []; foreach ($fields as $field) { $fieldsData['com_fields'][$field->name] = $field->rawvalue; } } // Set the new category ID $this->table->catid = $categoryId; // We don't want to modify tags - so remove the associated tags helper if ($this->table instanceof TaggableTableInterface) { $this->table->clearTagsHelper(); } // Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); return false; } // Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); return false; } // Run event for moved article Factory::getApplication()->triggerEvent('onContentAfterSave', ['com_content.article', &$this->table, false, $fieldsData]); } // Clean the cache $this->cleanCache(); return true; } /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canDelete($record) { if (empty($record->id) || ($record->state != -2)) { return false; } return $this->getCurrentUser()->authorise('core.delete', 'com_content.article.' . (int) $record->id); } /** * Method to test whether a record can have its state edited. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canEditState($record) { $user = $this->getCurrentUser(); // Check for existing article. if (!empty($record->id)) { return $user->authorise('core.edit.state', 'com_content.article.' . (int) $record->id); } // New article, so check against the category. if (!empty($record->catid)) { return $user->authorise('core.edit.state', 'com_content.category.' . (int) $record->catid); } // Default to component settings if neither article nor category known. return parent::canEditState($record); } /** * Prepare and sanitise the table data prior to saving. * * @param \Joomla\CMS\Table\Table $table A Table object. * * @return void * * @since 1.6 */ protected function prepareTable($table) { // Set the publish date to now if ($table->state == Workflow::CONDITION_PUBLISHED && (int) $table->publish_up == 0) { $table->publish_up = Factory::getDate()->toSql(); } if ($table->state == Workflow::CONDITION_PUBLISHED && intval($table->publish_down) == 0) { $table->publish_down = null; } // Increment the content version number. $table->version++; // Reorder the articles within the category so the new article is first if (empty($table->id)) { $table->reorder('catid = ' . (int) $table->catid . ' AND state >= 0'); } } /** * Method to change the published state of one or more records. * * @param array &$pks A list of the primary keys to change. * @param integer $value The value of the published state. * * @return boolean True on success. * * @since 4.0.0 */ public function publish(&$pks, $value = 1) { $this->workflowBeforeStageChange(); return parent::publish($pks, $value); } /** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { // Convert the params field to an array. $registry = new Registry($item->attribs); $item->attribs = $registry->toArray(); // Convert the metadata field to an array. $registry = new Registry($item->metadata); $item->metadata = $registry->toArray(); // Convert the images field to an array. $registry = new Registry($item->images); $item->images = $registry->toArray(); // Convert the urls field to an array. $registry = new Registry($item->urls); $item->urls = $registry->toArray(); $item->articletext = ($item->fulltext !== null && trim($item->fulltext) != '') ? $item->introtext . '<hr id="system-readmore">' . $item->fulltext : $item->introtext; if (!empty($item->id)) { $item->tags = new TagsHelper(); $item->tags->getTagIds($item->id, 'com_content.article'); $item->featured_up = null; $item->featured_down = null; if ($item->featured) { // Get featured dates. $db = $this->getDatabase(); $query = $db->getQuery(true) ->select( [ $db->quoteName('featured_up'), $db->quoteName('featured_down'), ] ) ->from($db->quoteName('#__content_frontpage')) ->where($db->quoteName('content_id') . ' = :id') ->bind(':id', $item->id, ParameterType::INTEGER); $featured = $db->setQuery($query)->loadObject(); if ($featured) { $item->featured_up = $featured->featured_up; $item->featured_down = $featured->featured_down; } } } } // Load associated content items $assoc = Associations::isEnabled(); if ($assoc) { $item->associations = []; if ($item->id != null) { $associations = Associations::getAssociations('com_content', '#__content', 'com_content.item', $item->id); foreach ($associations as $tag => $association) { $item->associations[$tag] = $association->id; } } } return $item; } /** * Method to get the record form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return Form|boolean A Form object on success, false on failure * * @since 1.6 */ public function getForm($data = [], $loadData = true) { $app = Factory::getApplication(); // Get the form. $form = $this->loadForm('com_content.article', 'article', ['control' => 'jform', 'load_data' => $loadData]); if (empty($form)) { return false; } // Object uses for checking edit state permission of article $record = new \stdClass(); // Get ID of the article from input, for frontend, we use a_id while backend uses id $articleIdFromInput = $app->isClient('site') ? $app->getInput()->getInt('a_id', 0) : $app->getInput()->getInt('id', 0); // On edit article, we get ID of article from article.id state, but on save, we use data from input $id = (int) $this->getState('article.id', $articleIdFromInput); $record->id = $id; // For new articles we load the potential state + associations if ($id == 0 && $formField = $form->getField('catid')) { $assignedCatids = $data['catid'] ?? $form->getValue('catid'); $assignedCatids = is_array($assignedCatids) ? (int) reset($assignedCatids) : (int) $assignedCatids; // Try to get the category from the category field if (empty($assignedCatids)) { $assignedCatids = $formField->getAttribute('default', null); if (!$assignedCatids) { // Choose the first category available $catOptions = $formField->options; if ($catOptions && !empty($catOptions[0]->value)) { $assignedCatids = (int) $catOptions[0]->value; } } } // Activate the reload of the form when category is changed $form->setFieldAttribute('catid', 'refresh-enabled', true); $form->setFieldAttribute('catid', 'refresh-cat-id', $assignedCatids); $form->setFieldAttribute('catid', 'refresh-section', 'article'); // Store ID of the category uses for edit state permission check $record->catid = $assignedCatids; } else { // Get the category which the article is being added to if (!empty($data['catid'])) { $catId = (int) $data['catid']; } else { $catIds = $form->getValue('catid'); $catId = is_array($catIds) ? (int) reset($catIds) : (int) $catIds; if (!$catId) { $catId = (int) $form->getFieldAttribute('catid', 'default', 0); } } $record->catid = $catId; } // Modify the form based on Edit State access controls. if (!$this->canEditState($record)) { // Disable fields for display. $form->setFieldAttribute('featured', 'disabled', 'true'); $form->setFieldAttribute('featured_up', 'disabled', 'true'); $form->setFieldAttribute('featured_down', 'disabled', 'true'); $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('publish_up', 'disabled', 'true'); $form->setFieldAttribute('publish_down', 'disabled', 'true'); $form->setFieldAttribute('state', 'disabled', 'true'); // Disable fields while saving. // The controller has already verified this is an article you can edit. $form->setFieldAttribute('featured', 'filter', 'unset'); $form->setFieldAttribute('featured_up', 'filter', 'unset'); $form->setFieldAttribute('featured_down', 'filter', 'unset'); $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('publish_up', 'filter', 'unset'); $form->setFieldAttribute('publish_down', 'filter', 'unset'); $form->setFieldAttribute('state', 'filter', 'unset'); } // Don't allow to change the created_by user if not allowed to access com_users. if (!$this->getCurrentUser()->authorise('core.manage', 'com_users')) { $form->setFieldAttribute('created_by', 'filter', 'unset'); } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered form data. $app = Factory::getApplication(); $data = $app->getUserState('com_content.edit.article.data', []); if (empty($data)) { $data = $this->getItem(); // Pre-select some filters (Status, Category, Language, Access) in edit form if those have been selected in Article Manager: Articles if ($this->getState('article.id') == 0) { $filters = (array) $app->getUserState('com_content.articles.filter'); $data->set( 'state', $app->getInput()->getInt( 'state', ((isset($filters['published']) && $filters['published'] !== '') ? $filters['published'] : null) ) ); $data->set('catid', $app->getInput()->getInt('catid', (!empty($filters['category_id']) ? $filters['category_id'] : null))); if ($app->isClient('administrator')) { $data->set('language', $app->getInput()->getString('language', (!empty($filters['language']) ? $filters['language'] : null))); } $data->set( 'access', $app->getInput()->getInt('access', (!empty($filters['access']) ? $filters['access'] : $app->get('access'))) ); } } // If there are params fieldsets in the form it will fail with a registry object if (isset($data->params) && $data->params instanceof Registry) { $data->params = $data->params->toArray(); } $this->preprocessData('com_content.article', $data); return $data; } /** * Method to validate the form data. * * @param Form $form The form to validate against. * @param array $data The data to validate. * @param string $group The name of the field group to validate. * * @return array|boolean Array of filtered data if valid, false otherwise. * * @see \Joomla\CMS\Form\FormRule * @see JFilterInput * @since 3.7.0 */ public function validate($form, $data, $group = null) { if (!$this->getCurrentUser()->authorise('core.admin', 'com_content')) { if (isset($data['rules'])) { unset($data['rules']); } } return parent::validate($form, $data, $group); } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $app = Factory::getApplication(); $input = $app->getInput(); $filter = InputFilter::getInstance(); if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); } if (isset($data['created_by_alias'])) { $data['created_by_alias'] = $filter->clean($data['created_by_alias'], 'TRIM'); } if (isset($data['images']) && is_array($data['images'])) { $registry = new Registry($data['images']); $data['images'] = (string) $registry; } $this->workflowBeforeSave(); // Create new category, if needed. $createCategory = true; if (is_null($data['catid'])) { // When there is no catid passed don't try to create one $createCategory = false; } // If category ID is provided, check if it's valid. if (is_numeric($data['catid']) && $data['catid']) { $createCategory = !CategoriesHelper::validateCategoryId($data['catid'], 'com_content'); } // Save New Category if ($createCategory && $this->canCreateCategory()) { $category = [ // Remove #new# prefix, if exists. 'title' => strpos($data['catid'], '#new#') === 0 ? substr($data['catid'], 5) : $data['catid'], 'parent_id' => 1, 'extension' => 'com_content', 'language' => $data['language'], 'published' => 1, ]; /** @var \Joomla\Component\Categories\Administrator\Model\CategoryModel $categoryModel */ $categoryModel = Factory::getApplication()->bootComponent('com_categories') ->getMVCFactory()->createModel('Category', 'Administrator', ['ignore_request' => true]); // Create new category. if (!$categoryModel->save($category)) { $this->setError($categoryModel->getError()); return false; } // Get the Category ID. $data['catid'] = $categoryModel->getState('category.id'); } if (isset($data['urls']) && is_array($data['urls'])) { $check = $input->post->get('jform', [], 'array'); foreach ($data['urls'] as $i => $url) { if ($url != false && ($i == 'urla' || $i == 'urlb' || $i == 'urlc')) { if (preg_match('~^#[a-zA-Z]{1}[a-zA-Z0-9-_:.]*$~', $check['urls'][$i]) == 1) { $data['urls'][$i] = $check['urls'][$i]; } else { $data['urls'][$i] = PunycodeHelper::urlToPunycode($url); } } } unset($check); $registry = new Registry($data['urls']); $data['urls'] = (string) $registry; } // Alter the title for save as copy if ($input->get('task') == 'save2copy') { $origTable = $this->getTable(); if ($app->isClient('site')) { $origTable->load($input->getInt('a_id')); if ($origTable->title === $data['title']) { /** * If title of article is not changed, set alias to original article alias so that Joomla! will generate * new Title and Alias for the copied article */ $data['alias'] = $origTable->alias; } else { $data['alias'] = ''; } } else { $origTable->load($input->getInt('id')); } if ($data['title'] == $origTable->title) { list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']); $data['title'] = $title; $data['alias'] = $alias; } elseif ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } // Automatic handling of alias for empty fields if (in_array($input->get('task'), ['apply', 'save', 'save2new']) && (!isset($data['id']) || (int) $data['id'] == 0)) { if ($data['alias'] == null) { if ($app->get('unicodeslugs') == 1) { $data['alias'] = OutputFilter::stringUrlUnicodeSlug($data['title']); } else { $data['alias'] = OutputFilter::stringURLSafe($data['title']); } $table = $this->getTable(); if ($table->load(['alias' => $data['alias'], 'catid' => $data['catid']])) { $msg = Text::_('COM_CONTENT_SAVE_WARNING'); } list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']); $data['alias'] = $alias; if (isset($msg)) { $app->enqueueMessage($msg, 'warning'); } } } if (parent::save($data)) { // Check if featured is set and if not managed by workflow if (isset($data['featured']) && !$this->bootComponent('com_content')->isFunctionalityUsed('core.featured', 'com_content.article')) { if ( !$this->featured( $this->getState($this->getName() . '.id'), $data['featured'], $data['featured_up'] ?? null, $data['featured_down'] ?? null ) ) { return false; } } $this->workflowAfterSave($data); return true; } return false; } /** * Method to toggle the featured setting of articles. * * @param array $pks The ids of the items to toggle. * @param integer $value The value to toggle to. * @param string|Date $featuredUp The date which item featured up. * @param string|Date $featuredDown The date which item featured down. * * @return boolean True on success. */ public function featured($pks, $value = 0, $featuredUp = null, $featuredDown = null) { // Sanitize the ids. $pks = (array) $pks; $pks = ArrayHelper::toInteger($pks); $value = (int) $value; $context = $this->option . '.' . $this->name; $this->workflowBeforeStageChange(); // Include the plugins for the change of state event. PluginHelper::importPlugin($this->events_map['featured']); // Convert empty strings to null for the query. if ($featuredUp === '') { $featuredUp = null; } if ($featuredDown === '') { $featuredDown = null; } if (empty($pks)) { $this->setError(Text::_('COM_CONTENT_NO_ITEM_SELECTED')); return false; } $table = $this->getTable('Featured', 'Administrator'); // Trigger the before change state event. $eventResult = Factory::getApplication()->getDispatcher()->dispatch( $this->event_before_change_featured, AbstractEvent::create( $this->event_before_change_featured, [ 'eventClass' => 'Joomla\Component\Content\Administrator\Event\Model\FeatureEvent', 'subject' => $this, 'extension' => $context, 'pks' => $pks, 'value' => $value, ] ) ); if ($eventResult->getArgument('abort', false)) { $this->setError(Text::_($eventResult->getArgument('abortReason'))); return false; } try { $db = $this->getDatabase(); $query = $db->getQuery(true) ->update($db->quoteName('#__content')) ->set($db->quoteName('featured') . ' = :featured') ->whereIn($db->quoteName('id'), $pks) ->bind(':featured', $value, ParameterType::INTEGER); $db->setQuery($query); $db->execute(); if ($value === 0) { // Adjust the mapping table. // Clear the existing features settings. $query = $db->getQuery(true) ->delete($db->quoteName('#__content_frontpage')) ->whereIn($db->quoteName('content_id'), $pks); $db->setQuery($query); $db->execute(); } else { // First, we find out which of our new featured articles are already featured. $query = $db->getQuery(true) ->select($db->quoteName('content_id')) ->from($db->quoteName('#__content_frontpage')) ->whereIn($db->quoteName('content_id'), $pks); $db->setQuery($query); $oldFeatured = $db->loadColumn(); // Update old featured articles if (count($oldFeatured)) { $query = $db->getQuery(true) ->update($db->quoteName('#__content_frontpage')) ->set( [ $db->quoteName('featured_up') . ' = :featuredUp', $db->quoteName('featured_down') . ' = :featuredDown', ] ) ->whereIn($db->quoteName('content_id'), $oldFeatured) ->bind(':featuredUp', $featuredUp, $featuredUp ? ParameterType::STRING : ParameterType::NULL) ->bind(':featuredDown', $featuredDown, $featuredDown ? ParameterType::STRING : ParameterType::NULL); $db->setQuery($query); $db->execute(); } // We diff the arrays to get a list of the articles that are newly featured $newFeatured = array_diff($pks, $oldFeatured); // Featuring. if ($newFeatured) { $query = $db->getQuery(true) ->insert($db->quoteName('#__content_frontpage')) ->columns( [ $db->quoteName('content_id'), $db->quoteName('ordering'), $db->quoteName('featured_up'), $db->quoteName('featured_down'), ] ); $dataTypes = [ ParameterType::INTEGER, ParameterType::INTEGER, $featuredUp ? ParameterType::STRING : ParameterType::NULL, $featuredDown ? ParameterType::STRING : ParameterType::NULL, ]; foreach ($newFeatured as $pk) { $query->values(implode(',', $query->bindArray([$pk, 0, $featuredUp, $featuredDown], $dataTypes))); } $db->setQuery($query); $db->execute(); } } } catch (\Exception $e) { $this->setError($e->getMessage()); return false; } $table->reorder(); // Trigger the change state event. Factory::getApplication()->getDispatcher()->dispatch( $this->event_after_change_featured, AbstractEvent::create( $this->event_after_change_featured, [ 'eventClass' => 'Joomla\Component\Content\Administrator\Event\Model\FeatureEvent', 'subject' => $this, 'extension' => $context, 'pks' => $pks, 'value' => $value, ] ) ); $this->cleanCache(); return true; } /** * A protected method to get a set of ordering conditions. * * @param object $table A record object. * * @return array An array of conditions to add to ordering queries. * * @since 1.6 */ protected function getReorderConditions($table) { return [ $this->getDatabase()->quoteName('catid') . ' = ' . (int) $table->catid, ]; } /** * Allows preprocessing of the Form object. * * @param Form $form The form object * @param array $data The data to be merged into the form object * @param string $group The plugin group to be executed * * @return void * * @since 3.0 */ protected function preprocessForm(Form $form, $data, $group = 'content') { if ($this->canCreateCategory()) { $form->setFieldAttribute('catid', 'allowAdd', 'true'); // Add a prefix for categories created on the fly. $form->setFieldAttribute('catid', 'customPrefix', '#new#'); } // Association content items if (Associations::isEnabled()) { $languages = LanguageHelper::getContentLanguages(false, false, null, 'ordering', 'asc'); if (count($languages) > 1) { $addform = new \SimpleXMLElement('<form />'); $fields = $addform->addChild('fields'); $fields->addAttribute('name', 'associations'); $fieldset = $fields->addChild('fieldset'); $fieldset->addAttribute('name', 'item_associations'); foreach ($languages as $language) { $field = $fieldset->addChild('field'); $field->addAttribute('name', $language->lang_code); $field->addAttribute('type', 'modal_article'); $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); $field->addAttribute('select', 'true'); $field->addAttribute('new', 'true'); $field->addAttribute('edit', 'true'); $field->addAttribute('clear', 'true'); $field->addAttribute('propagate', 'true'); } $form->load($addform, false); } } $this->workflowPreprocessForm($form, $data); parent::preprocessForm($form, $data, $group); } /** * Custom clean the cache of com_content and content modules * * @param string $group The cache group * @param integer $clientId No longer used, will be removed without replacement * @deprecated 4.3 will be removed in 6.0 * * @return void * * @since 1.6 */ protected function cleanCache($group = null, $clientId = 0) { parent::cleanCache('com_content'); parent::cleanCache('mod_articles_archive'); parent::cleanCache('mod_articles_categories'); parent::cleanCache('mod_articles_category'); parent::cleanCache('mod_articles_latest'); parent::cleanCache('mod_articles_news'); parent::cleanCache('mod_articles_popular'); } /** * Void hit function for pagebreak when editing content from frontend * * @return void * * @since 3.6.0 */ public function hit() { } /** * Is the user allowed to create an on the fly category? * * @return boolean * * @since 3.6.1 */ private function canCreateCategory() { return $this->getCurrentUser()->authorise('core.create', 'com_content'); } /** * Delete #__content_frontpage items if the deleted articles was featured * * @param array $pks The primary key related to the contents that was deleted. * * @return boolean * * @since 3.7.0 */ public function delete(&$pks) { $return = parent::delete($pks); if ($return) { // Now check to see if this articles was featured if so delete it from the #__content_frontpage table $db = $this->getDatabase(); $query = $db->getQuery(true) ->delete($db->quoteName('#__content_frontpage')) ->whereIn($db->quoteName('content_id'), $pks); $db->setQuery($query); $db->execute(); $this->workflow->deleteAssociation($pks); } return $return; } } src/View/Article/HtmlView.php 0000644 00000017012 15172746405 0012114 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\View\Article; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Content\Site\Helper\RouteHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * View to edit an article. * * @since 1.6 */ class HtmlView extends BaseHtmlView { /** * The \JForm object * * @var \Joomla\CMS\Form\Form */ protected $form; /** * The active item * * @var object */ protected $item; /** * The model state * * @var object */ protected $state; /** * The actions the user is authorised to perform * * @var \Joomla\CMS\Object\CMSObject */ protected $canDo; /** * Pagebreak TOC alias * * @var string */ protected $eName; /** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void * * @since 1.6 * * @throws \Exception */ public function display($tpl = null) { if ($this->getLayout() == 'pagebreak') { parent::display($tpl); return; } $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->canDo = ContentHelper::getActions('com_content', 'article', $this->item->id); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } // If we are forcing a language in modal (used for associations). if ($this->getLayout() === 'modal' && $forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'cmd')) { // Set the language field to the forcedLanguage and disable changing it. $this->form->setValue('language', null, $forcedLanguage); $this->form->setFieldAttribute('language', 'readonly', 'true'); // Only allow to select categories with All language or with the forced language. $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); // Only allow to select tags with All language or with the forced language. $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); } $this->addToolbar(); parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 * * @throws \Exception */ protected function addToolbar() { Factory::getApplication()->getInput()->set('hidemainmenu', true); $user = $this->getCurrentUser(); $userId = $user->id; $isNew = ($this->item->id == 0); $checkedOut = !(is_null($this->item->checked_out) || $this->item->checked_out == $userId); $toolbar = Toolbar::getInstance(); // Built the actions for new and existing records. $canDo = $this->canDo; ToolbarHelper::title( Text::_('COM_CONTENT_PAGE_' . ($checkedOut ? 'VIEW_ARTICLE' : ($isNew ? 'ADD_ARTICLE' : 'EDIT_ARTICLE'))), 'pencil-alt article-add' ); // For new records, check the create permission. if ($isNew && (count($user->getAuthorisedCategories('com_content', 'core.create')) > 0)) { $toolbar->apply('article.apply'); $saveGroup = $toolbar->dropdownButton('save-group'); $saveGroup->configure( function (Toolbar $childBar) use ($user) { $childBar->save('article.save'); if ($user->authorise('core.create', 'com_menus.menu')) { $childBar->save('article.save2menu', 'JTOOLBAR_SAVE_TO_MENU'); } $childBar->save2new('article.save2new'); } ); $toolbar->cancel('article.cancel', 'JTOOLBAR_CANCEL'); } else { // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. $itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId); if (!$checkedOut && $itemEditable) { $toolbar->apply('article.apply'); } $saveGroup = $toolbar->dropdownButton('save-group'); $saveGroup->configure( function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo, $user) { // Can't save the record if it's checked out and editable if (!$checkedOut && $itemEditable) { $childBar->save('article.save'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { $childBar->save2new('article.save2new'); } } // If checked out, we can still save2menu if ($user->authorise('core.create', 'com_menus.menu')) { $childBar->save('article.save2menu', 'JTOOLBAR_SAVE_TO_MENU'); } // If checked out, we can still save if ($canDo->get('core.create')) { $childBar->save2copy('article.save2copy'); } } ); $toolbar->cancel('article.cancel', 'JTOOLBAR_CLOSE'); if (!$isNew) { if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable) { $toolbar->versions('com_content.article', $this->item->id); } $url = RouteHelper::getArticleRoute($this->item->id . ':' . $this->item->alias, $this->item->catid, $this->item->language); $toolbar->preview(Route::link('site', $url, true), 'JGLOBAL_PREVIEW') ->bodyHeight(80) ->modalWidth(90); if (PluginHelper::isEnabled('system', 'jooa11y')) { $toolbar->jooa11y(Route::link('site', $url . '&jooa11y=1', true), 'JGLOBAL_JOOA11Y') ->bodyHeight(80) ->modalWidth(90); } if (Associations::isEnabled() && ComponentHelper::isEnabled('com_associations')) { $toolbar->standardButton('associations', 'JTOOLBAR_ASSOCIATIONS', 'article.editAssociations') ->icon('icon-contract') ->listCheck(false); } } } $toolbar->divider(); $toolbar->inlinehelp(); $toolbar->help('Articles:_Edit'); } } src/View/Featured/HtmlView.php 0000644 00000015251 15172746405 0012273 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\View\Featured; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Toolbar\Button\DropdownButton; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Content\Administrator\Extension\ContentComponent; use Joomla\Component\Content\Administrator\Helper\ContentHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * View class for a list of featured articles. * * @since 1.6 */ class HtmlView extends BaseHtmlView { /** * An array of items * * @var array */ protected $items; /** * The pagination object * * @var \Joomla\CMS\Pagination\Pagination */ protected $pagination; /** * The model state * * @var \Joomla\CMS\Object\CMSObject */ protected $state; /** * Form object for search filters * * @var \Joomla\CMS\Form\Form */ public $filterForm; /** * The active search filters * * @var array */ public $activeFilters; /** * All transition, which can be executed of one if the items * * @var array */ protected $transitions = []; /** * Is this view an Empty State * * @var boolean * @since 4.0.0 */ private $isEmptyState = false; /** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); $this->vote = PluginHelper::isEnabled('content', 'vote'); $this->hits = ComponentHelper::getParams('com_content')->get('record_hits', 1); if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) { $this->setLayout('emptystate'); } if (ComponentHelper::getParams('com_content')->get('workflow_enabled')) { PluginHelper::importPlugin('workflow'); $this->transitions = $this->get('Transitions'); } // Check for errors. if (\count($errors = $this->get('Errors'))) { throw new GenericDataException(implode("\n", $errors), 500); } $this->addToolbar(); // We do not need to filter by language when multilingual is disabled if (!Multilanguage::isEnabled()) { unset($this->activeFilters['language']); $this->filterForm->removeField('language', 'filter'); } parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id')); $user = Factory::getApplication()->getIdentity(); $toolbar = Toolbar::getInstance(); ToolbarHelper::title(Text::_('COM_CONTENT_FEATURED_TITLE'), 'star featured'); if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) { $toolbar->addNew('article.add'); } if (!$this->isEmptyState && ($canDo->get('core.edit.state') || \count($this->transitions))) { /** @var DropdownButton $dropdown */ $dropdown = $toolbar->dropdownButton('status-group', 'JTOOLBAR_CHANGE_STATUS') ->toggleSplit(false) ->icon('icon-ellipsis-h') ->buttonClass('btn btn-action') ->listCheck(true); $childBar = $dropdown->getChildToolbar(); if (\count($this->transitions)) { $childBar->separatorButton('transition-headline', 'COM_CONTENT_RUN_TRANSITIONS') ->buttonClass('text-center py-2 h3'); $cmd = "Joomla.submitbutton('articles.runTransition');"; $messages = "{error: [Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}"; $alert = 'Joomla.renderMessages(' . $messages . ')'; $cmd = 'if (document.adminForm.boxchecked.value == 0) { ' . $alert . ' } else { ' . $cmd . ' }'; foreach ($this->transitions as $transition) { $childBar->standardButton('transition', $transition['text']) ->buttonClass('transition-' . (int) $transition['value']) ->icon('icon-project-diagram') ->onclick('document.adminForm.transition_id.value=' . (int) $transition['value'] . ';' . $cmd); } $childBar->separatorButton('transition-separator'); } if ($canDo->get('core.edit.state')) { $childBar->publish('articles.publish')->listCheck(true); $childBar->unpublish('articles.unpublish')->listCheck(true); $childBar->standardButton('unfeatured', 'JUNFEATURE') ->task('articles.unfeatured') ->listCheck(true); $childBar->archive('articles.archive')->listCheck(true); $childBar->checkin('articles.checkin'); if (!$this->state->get('filter.published') == ContentComponent::CONDITION_TRASHED) { $childBar->trash('articles.trash')->listCheck(true); } } } if (!$this->isEmptyState && $this->state->get('filter.published') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete')) { $toolbar->delete('articles.delete', 'JTOOLBAR_EMPTY_TRASH') ->message('JGLOBAL_CONFIRM_DELETE') ->listCheck(true); } if ($user->authorise('core.admin', 'com_content') || $user->authorise('core.options', 'com_content')) { $toolbar->preferences('com_content'); } $toolbar->help('Articles:_Featured'); } } src/View/Articles/HtmlView.php 0000644 00000021362 15172746405 0012302 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\View\Articles; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Toolbar\Button\DropdownButton; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Content\Administrator\Extension\ContentComponent; use Joomla\Component\Content\Administrator\Helper\ContentHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * View class for a list of articles. * * @since 1.6 */ class HtmlView extends BaseHtmlView { /** * An array of items * * @var array */ protected $items; /** * The pagination object * * @var \Joomla\CMS\Pagination\Pagination */ protected $pagination; /** * The model state * * @var \Joomla\CMS\Object\CMSObject */ protected $state; /** * Form object for search filters * * @var \Joomla\CMS\Form\Form */ public $filterForm; /** * The active search filters * * @var array */ public $activeFilters; /** * All transition, which can be executed of one if the items * * @var array */ protected $transitions = []; /** * Is this view an Empty State * * @var boolean * @since 4.0.0 */ private $isEmptyState = false; /** * Is the vote plugin enabled on the site * * @var boolean * @since 4.4.0 */ protected $vote = false; /** * Are hits being recorded on the site? * * @var boolean * @since 4.4.0 */ protected $hits = false; /** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); $this->vote = PluginHelper::isEnabled('content', 'vote'); $this->hits = ComponentHelper::getParams('com_content')->get('record_hits', 1) == 1; if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) { $this->setLayout('emptystate'); } if (ComponentHelper::getParams('com_content')->get('workflow_enabled')) { PluginHelper::importPlugin('workflow'); $this->transitions = $this->get('Transitions'); } // Check for errors. if (\count($errors = $this->get('Errors')) || $this->transitions === false) { throw new GenericDataException(implode("\n", $errors), 500); } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); // We do not need to filter by language when multilingual is disabled if (!Multilanguage::isEnabled()) { unset($this->activeFilters['language']); $this->filterForm->removeField('language', 'filter'); } } else { // In article associations modal we need to remove language filter if forcing a language. // We also need to change the category filter to show show categories with All or the forced language. if ($forcedLanguage = Factory::getApplication()->getInput()->get('forcedLanguage', '', 'CMD')) { // If the language is forced we can't allow to select the language, so transform the language selector filter into a hidden field. $languageXml = new \SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />'); $this->filterForm->setField($languageXml, 'filter', true); // Also, unset the active language filter so the search tools is not open by default with this filter. unset($this->activeFilters['language']); // One last changes needed is to change the category filter to just show categories with All language or with the forced language. $this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter'); } } parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { $canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id')); $user = $this->getCurrentUser(); $toolbar = Toolbar::getInstance(); ToolbarHelper::title(Text::_('COM_CONTENT_ARTICLES_TITLE'), 'copy article'); if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) { $toolbar->addNew('article.add'); } if (!$this->isEmptyState && ($canDo->get('core.edit.state') || \count($this->transitions))) { /** @var DropdownButton $dropdown */ $dropdown = $toolbar->dropdownButton('status-group') ->text('JTOOLBAR_CHANGE_STATUS') ->toggleSplit(false) ->icon('icon-ellipsis-h') ->buttonClass('btn btn-action') ->listCheck(true); $childBar = $dropdown->getChildToolbar(); if ($canDo->get('core.execute.transition') && \count($this->transitions)) { $childBar->separatorButton('transition-headline') ->text('COM_CONTENT_RUN_TRANSITIONS') ->buttonClass('text-center py-2 h3'); $cmd = "Joomla.submitbutton('articles.runTransition');"; $messages = "{error: [Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}"; $alert = 'Joomla.renderMessages(' . $messages . ')'; $cmd = 'if (document.adminForm.boxchecked.value == 0) { ' . $alert . ' } else { ' . $cmd . ' }'; foreach ($this->transitions as $transition) { $childBar->standardButton('transition', $transition['text']) ->buttonClass('transition-' . (int) $transition['value']) ->icon('icon-project-diagram') ->onclick('document.adminForm.transition_id.value=' . (int) $transition['value'] . ';' . $cmd); } $childBar->separatorButton('transition-separator'); } if ($canDo->get('core.edit.state')) { $childBar->publish('articles.publish')->listCheck(true); $childBar->unpublish('articles.unpublish')->listCheck(true); $childBar->standardButton('featured', 'JFEATURE', 'articles.featured') ->listCheck(true); $childBar->standardButton('unfeatured', 'JUNFEATURE', 'articles.unfeatured') ->listCheck(true); $childBar->archive('articles.archive')->listCheck(true); $childBar->checkin('articles.checkin'); if ($this->state->get('filter.published') != ContentComponent::CONDITION_TRASHED) { $childBar->trash('articles.trash')->listCheck(true); } } // Add a batch button if ( $user->authorise('core.create', 'com_content') && $user->authorise('core.edit', 'com_content') ) { $childBar->popupButton('batch', 'JTOOLBAR_BATCH') ->selector('collapseModal') ->listCheck(true); } } if (!$this->isEmptyState && $this->state->get('filter.published') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete')) { $toolbar->delete('articles.delete', 'JTOOLBAR_EMPTY_TRASH') ->message('JGLOBAL_CONFIRM_DELETE') ->listCheck(true); } if ($user->authorise('core.admin', 'com_content') || $user->authorise('core.options', 'com_content')) { $toolbar->preferences('com_content'); } $toolbar->help('Articles'); } } src/Service/HTML/Icon.php 0000644 00000012606 15172746405 0011120 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Service\HTML; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Workflow\Workflow; use Joomla\Component\Content\Site\Helper\RouteHelper; use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Content Component HTML Helper * * @since 4.0.0 */ class Icon { /** * Method to generate a link to the create item page for the given category * * @param object $category The category information * @param Registry $params The item parameters * @param array $attribs Optional attributes for the link * @param boolean $legacy True to use legacy images, false to use icomoon based graphic * * @return string The HTML markup for the create item link * * @since 4.0.0 */ public function create($category, $params, $attribs = [], $legacy = false) { $uri = Uri::getInstance(); $url = 'index.php?option=com_content&task=article.add&return=' . base64_encode($uri) . '&a_id=0&catid=' . $category->id; $text = ''; if ($params->get('show_icons')) { $text .= '<span class="icon-plus icon-fw" aria-hidden="true"></span>'; } $text .= Text::_('COM_CONTENT_NEW_ARTICLE'); // Add the button classes to the attribs array if (isset($attribs['class'])) { $attribs['class'] .= ' btn btn-primary'; } else { $attribs['class'] = 'btn btn-primary'; } $button = HTMLHelper::_('link', Route::_($url), $text, $attribs); return $button; } /** * Display an edit icon for the article. * * This icon will not display in a popup window, nor if the article is trashed. * Edit access checks must be performed in the calling code. * * @param object $article The article information * @param Registry $params The item parameters * @param array $attribs Optional attributes for the link * @param boolean $legacy True to use legacy images, false to use icomoon based graphic * * @return string The HTML for the article edit icon. * * @since 4.0.0 */ public function edit($article, $params, $attribs = [], $legacy = false) { $user = Factory::getUser(); $uri = Uri::getInstance(); // Ignore if in a popup window. if ($params && $params->get('popup')) { return ''; } // Ignore if the state is negative (trashed). if (!in_array($article->state, [Workflow::CONDITION_UNPUBLISHED, Workflow::CONDITION_PUBLISHED])) { return ''; } // Show checked_out icon if the article is checked out by a different user if ( property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') && !is_null($article->checked_out) && $article->checked_out != $user->get('id') ) { $checkoutUser = Factory::getUser($article->checked_out); $date = HTMLHelper::_('date', $article->checked_out_time); $tooltip = Text::sprintf('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name) . ' <br> ' . $date; $text = LayoutHelper::render('joomla.content.icons.edit_lock', ['article' => $article, 'tooltip' => $tooltip, 'legacy' => $legacy]); $attribs['aria-describedby'] = 'editarticle-' . (int) $article->id; $output = HTMLHelper::_('link', '#', $text, $attribs); return $output; } $contentUrl = RouteHelper::getArticleRoute($article->slug, $article->catid, $article->language); $url = $contentUrl . '&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode($uri); if ($article->state == Workflow::CONDITION_UNPUBLISHED) { $tooltip = Text::_('COM_CONTENT_EDIT_UNPUBLISHED_ARTICLE'); } else { $tooltip = Text::_('COM_CONTENT_EDIT_PUBLISHED_ARTICLE'); } $text = LayoutHelper::render('joomla.content.icons.edit', ['article' => $article, 'tooltip' => $tooltip, 'legacy' => $legacy]); $attribs['aria-describedby'] = 'editarticle-' . (int) $article->id; $output = HTMLHelper::_('link', Route::_($url), $text, $attribs); return $output; } /** * Method to generate a link to print an article * * @param Registry $params The item parameters * @param boolean $legacy True to use legacy images, false to use icomoon based graphic * * @return string The HTML markup for the popup link * * @since 4.0.0 */ public function print_screen($params, $legacy = false) { $text = LayoutHelper::render('joomla.content.icons.print_screen', ['params' => $params, 'legacy' => $legacy]); return '<button type="button" onclick="window.print();return false;">' . $text . '</button>'; } } src/Service/HTML/AdministratorService.php 0000644 00000010057 15172746405 0014367 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Service\HTML; use Joomla\CMS\Factory; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\Database\ParameterType; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Content HTML helper * * @since 3.0 */ class AdministratorService { /** * Render the list of associated items * * @param integer $articleid The article item id * * @return string The language HTML * * @throws \Exception */ public function association($articleid) { // Defaults $html = ''; // Get the associations if ($associations = Associations::getAssociations('com_content', '#__content', 'com_content.item', $articleid)) { foreach ($associations as $tag => $associated) { $associations[$tag] = (int) $associated->id; } // Get the associated menu items $db = Factory::getDbo(); $query = $db->getQuery(true) ->select( [ 'c.*', $db->quoteName('l.sef', 'lang_sef'), $db->quoteName('l.lang_code'), $db->quoteName('cat.title', 'category_title'), $db->quoteName('l.image'), $db->quoteName('l.title', 'language_title'), ] ) ->from($db->quoteName('#__content', 'c')) ->join('LEFT', $db->quoteName('#__categories', 'cat'), $db->quoteName('cat.id') . ' = ' . $db->quoteName('c.catid')) ->join('LEFT', $db->quoteName('#__languages', 'l'), $db->quoteName('c.language') . ' = ' . $db->quoteName('l.lang_code')) ->whereIn($db->quoteName('c.id'), array_values($associations)) ->where($db->quoteName('c.id') . ' != :articleId') ->bind(':articleId', $articleid, ParameterType::INTEGER); $db->setQuery($query); try { $items = $db->loadObjectList('id'); } catch (\RuntimeException $e) { throw new \Exception($e->getMessage(), 500, $e); } if ($items) { $languages = LanguageHelper::getContentLanguages([0, 1]); $content_languages = array_column($languages, 'lang_code'); foreach ($items as &$item) { if (in_array($item->lang_code, $content_languages)) { $text = $item->lang_code; $url = Route::_('index.php?option=com_content&task=article.edit&id=' . (int) $item->id); $tooltip = '<strong>' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '</strong><br>' . htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '<br>' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title); $classes = 'badge bg-secondary'; $item->link = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>' . '<div role="tooltip" id="tip-' . (int) $articleid . '-' . (int) $item->id . '">' . $tooltip . '</div>'; } else { // Display warning if Content Language is trashed or deleted Factory::getApplication()->enqueueMessage(Text::sprintf('JGLOBAL_ASSOCIATIONS_CONTENTLANGUAGE_WARNING', $item->lang_code), 'warning'); } } } $html = LayoutHelper::render('joomla.content.associations', $items); } return $html; } } src/Field/VoteradioField.php 0000644 00000003243 15172746405 0012004 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Field; use Joomla\CMS\Form\Field\RadioField; use Joomla\CMS\Plugin\PluginHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Voteradio Field class. * * @since 3.8.0 */ class VoteradioField extends RadioField { /** * The form field type. * * @var string * @since 3.8.0 */ protected $type = 'Voteradio'; /** * Method to attach a form object to the field. * * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * * @return boolean True on success. * * @since 4.0.0 */ public function setup(\SimpleXMLElement $element, $value, $group = null) { // Requires vote plugin enabled if (!PluginHelper::isEnabled('content', 'vote')) { return false; } return parent::setup($element, $value, $group); } } src/Field/AssocField.php 0000644 00000003332 15172746405 0011117 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Field; use Joomla\CMS\Form\Field\ListField; use Joomla\CMS\Language\Associations; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Assoc Field class. * Supports a generic list of options. * Displays only when Associations are enabled. * * @since 4.0.0 */ class AssocField extends ListField { /** * The form field type. * * @var string * @since 4.0.0 */ protected $type = 'Assoc'; /** * Method to attach a Form object to the field. * * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * * @return boolean True on success. * * @see AssocField::setup() * @since 4.0.0 */ public function setup(\SimpleXMLElement $element, $value, $group = null) { if (!Associations::isEnabled()) { return false; } return parent::setup($element, $value, $group); } } src/Field/Modal/ArticleField.php 0000644 00000030374 15172746405 0012474 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Field\Modal; use Joomla\CMS\Factory; use Joomla\CMS\Form\FormField; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Session\Session; use Joomla\Database\ParameterType; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Supports a modal article picker. * * @since 1.6 */ class ArticleField extends FormField { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'Modal_Article'; /** * Method to get the field input markup. * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { $allowNew = ((string) $this->element['new'] == 'true'); $allowEdit = ((string) $this->element['edit'] == 'true'); $allowClear = ((string) $this->element['clear'] != 'false'); $allowSelect = ((string) $this->element['select'] != 'false'); $allowPropagate = ((string) $this->element['propagate'] == 'true'); $languages = LanguageHelper::getContentLanguages([0, 1], false); // Load language Factory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR); // The active article id field. $value = (int) $this->value ?: ''; // Create the modal id. $modalId = 'Article_' . $this->id; /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = Factory::getApplication()->getDocument()->getWebAssetManager(); // Add the modal field script to the document head. $wa->useScript('field.modal-fields'); // Script to proxy the select modal function to the modal-fields.js file. if ($allowSelect) { static $scriptSelect = null; if (is_null($scriptSelect)) { $scriptSelect = []; } if (!isset($scriptSelect[$this->id])) { $wa->addInlineScript( " window.jSelectArticle_" . $this->id . " = function (id, title, catid, object, url, language) { window.processModalSelect('Article', '" . $this->id . "', id, title, catid, object, url, language); }", [], ['type' => 'module'] ); Text::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED'); $scriptSelect[$this->id] = true; } } // Setup variables for display. $linkArticles = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&' . Session::getFormToken() . '=1'; $linkArticle = 'index.php?option=com_content&view=article&layout=modal&tmpl=component&' . Session::getFormToken() . '=1'; if (isset($this->element['language'])) { $linkArticles .= '&forcedLanguage=' . $this->element['language']; $linkArticle .= '&forcedLanguage=' . $this->element['language']; $modalTitle = Text::_('COM_CONTENT_SELECT_AN_ARTICLE') . ' — ' . $this->element['label']; } else { $modalTitle = Text::_('COM_CONTENT_SELECT_AN_ARTICLE'); } $urlSelect = $linkArticles . '&function=jSelectArticle_' . $this->id; $urlEdit = $linkArticle . '&task=article.edit&id=\' + document.getElementById("' . $this->id . '_id").value + \''; $urlNew = $linkArticle . '&task=article.add'; if ($value) { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select($db->quoteName('title')) ->from($db->quoteName('#__content')) ->where($db->quoteName('id') . ' = :value') ->bind(':value', $value, ParameterType::INTEGER); $db->setQuery($query); try { $title = $db->loadResult(); } catch (\RuntimeException $e) { Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } if (empty($title)) { $value = ''; } } $title = empty($title) ? Text::_('COM_CONTENT_SELECT_AN_ARTICLE') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); // The current article display field. $html = ''; if ($allowSelect || $allowNew || $allowEdit || $allowClear) { $html .= '<span class="input-group">'; } $html .= '<input class="form-control" id="' . $this->id . '_name" type="text" value="' . $title . '" readonly size="35">'; // Select article button if ($allowSelect) { $html .= '<button' . ' class="btn btn-primary' . ($value ? ' hidden' : '') . '"' . ' id="' . $this->id . '_select"' . ' data-bs-toggle="modal"' . ' type="button"' . ' data-bs-target="#ModalSelect' . $modalId . '">' . '<span class="icon-file" aria-hidden="true"></span> ' . Text::_('JSELECT') . '</button>'; } // New article button if ($allowNew) { $html .= '<button' . ' class="btn btn-secondary' . ($value ? ' hidden' : '') . '"' . ' id="' . $this->id . '_new"' . ' data-bs-toggle="modal"' . ' type="button"' . ' data-bs-target="#ModalNew' . $modalId . '">' . '<span class="icon-plus" aria-hidden="true"></span> ' . Text::_('JACTION_CREATE') . '</button>'; } // Edit article button if ($allowEdit) { $html .= '<button' . ' class="btn btn-primary' . ($value ? '' : ' hidden') . '"' . ' id="' . $this->id . '_edit"' . ' data-bs-toggle="modal"' . ' type="button"' . ' data-bs-target="#ModalEdit' . $modalId . '">' . '<span class="icon-pen-square" aria-hidden="true"></span> ' . Text::_('JACTION_EDIT') . '</button>'; } // Clear article button if ($allowClear) { $html .= '<button' . ' class="btn btn-secondary' . ($value ? '' : ' hidden') . '"' . ' id="' . $this->id . '_clear"' . ' type="button"' . ' onclick="window.processModalParent(\'' . $this->id . '\'); return false;">' . '<span class="icon-times" aria-hidden="true"></span> ' . Text::_('JCLEAR') . '</button>'; } // Propagate article button if ($allowPropagate && count($languages) > 2) { // Strip off language tag at the end $tagLength = (int) strlen($this->element['language']); $callbackFunctionStem = substr("jSelectArticle_" . $this->id, 0, -$tagLength); $html .= '<button' . ' class="btn btn-primary' . ($value ? '' : ' hidden') . '"' . ' type="button"' . ' id="' . $this->id . '_propagate"' . ' title="' . Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_TIP') . '"' . ' onclick="Joomla.propagateAssociation(\'' . $this->id . '\', \'' . $callbackFunctionStem . '\');">' . '<span class="icon-sync" aria-hidden="true"></span> ' . Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_BUTTON') . '</button>'; } if ($allowSelect || $allowNew || $allowEdit || $allowClear) { $html .= '</span>'; } // Select article modal if ($allowSelect) { $html .= HTMLHelper::_( 'bootstrap.renderModal', 'ModalSelect' . $modalId, [ 'title' => $modalTitle, 'url' => $urlSelect, 'height' => '400px', 'width' => '800px', 'bodyHeight' => 70, 'modalWidth' => 80, 'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>', ] ); } // New article modal if ($allowNew) { $html .= HTMLHelper::_( 'bootstrap.renderModal', 'ModalNew' . $modalId, [ 'title' => Text::_('COM_CONTENT_NEW_ARTICLE'), 'backdrop' => 'static', 'keyboard' => false, 'closeButton' => false, 'url' => $urlNew, 'height' => '400px', 'width' => '800px', 'bodyHeight' => 70, 'modalWidth' => 80, 'footer' => '<button type="button" class="btn btn-secondary"' . ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'article\', \'cancel\', \'item-form\'); return false;">' . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>' . '<button type="button" class="btn btn-primary"' . ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'article\', \'save\', \'item-form\'); return false;">' . Text::_('JSAVE') . '</button>' . '<button type="button" class="btn btn-success"' . ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'article\', \'apply\', \'item-form\'); return false;">' . Text::_('JAPPLY') . '</button>', ] ); } // Edit article modal if ($allowEdit) { $html .= HTMLHelper::_( 'bootstrap.renderModal', 'ModalEdit' . $modalId, [ 'title' => Text::_('COM_CONTENT_EDIT_ARTICLE'), 'backdrop' => 'static', 'keyboard' => false, 'closeButton' => false, 'url' => $urlEdit, 'height' => '400px', 'width' => '800px', 'bodyHeight' => 70, 'modalWidth' => 80, 'footer' => '<button type="button" class="btn btn-secondary"' . ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'article\', \'cancel\', \'item-form\'); return false;">' . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>' . '<button type="button" class="btn btn-primary"' . ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'article\', \'save\', \'item-form\'); return false;">' . Text::_('JSAVE') . '</button>' . '<button type="button" class="btn btn-success"' . ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'article\', \'apply\', \'item-form\'); return false;">' . Text::_('JAPPLY') . '</button>', ] ); } // Note: class='required' for client side validation. $class = $this->required ? ' class="required modal-value"' : ''; $html .= '<input type="hidden" id="' . $this->id . '_id" ' . $class . ' data-required="' . (int) $this->required . '" name="' . $this->name . '" data-text="' . htmlspecialchars(Text::_('COM_CONTENT_SELECT_AN_ARTICLE'), ENT_COMPAT, 'UTF-8') . '" value="' . $value . '">'; return $html; } /** * Method to get the field label markup. * * @return string The field label markup. * * @since 3.4 */ protected function getLabel() { return str_replace($this->id, $this->id . '_name', parent::getLabel()); } } src/Field/VotelistField.php 0000644 00000003236 15172746405 0011663 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_content * * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Content\Administrator\Field; use Joomla\CMS\Form\Field\ListField; use Joomla\CMS\Plugin\PluginHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Votelist Field class. * * @since 4.0.0 */ class VotelistField extends ListField { /** * The form field type. * * @var string * @since 4.0.0 */ protected $type = 'Votelist'; /** * Method to attach a form object to the field. * * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * * @return boolean True on success. * * @since 4.0.0 */ public function setup(\SimpleXMLElement $element, $value, $group = null) { // Requires vote plugin enabled if (!PluginHelper::isEnabled('content', 'vote')) { return false; } return parent::setup($element, $value, $group); } } js/articles-status-es5.js 0000644 00000001046 15173022122 0011333 0 ustar 00 (function () { 'use strict'; /** * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ (function () { document.addEventListener('DOMContentLoaded', function () { var elements = [].slice.call(document.querySelectorAll('.article-status')); elements.forEach(function (element) { element.addEventListener('click', function (event) { event.stopPropagation(); }); }); }); })(); })(); js/admin-articles-modal.min.js.gz 0000644 00000000756 15173022122 0012710 0 ustar 00 � �R�j1��+Ta�ʬ�6�b[�ׄ')��B��x�D���l���/� ��M/9�8��ͼ73������K0ŖK悝~��]����WA#�"1eNK6��q<�v;y��C��[Y��Ed���_���gug�f�7� C4ޱS��@&,"���|q�ZHz��v��~'�WhQ�,��U�SL)�ԦF����I(��K2�ń?S>��<r�֨�������`ON�cm�y�|"��>b"&ڻH5�|�F�s|�z lp�x�� ���R����Y�h���&���LG��'�u��4.8����ʀ��ݪ�wI��n���걭�]ax��0�6�25���az�x��^B�/����Dj�!����STY��آ�q����%Ҙ�)(j5͈�����pS��S.&����߄�uo�69H79�A�Y<j���*k�T�c����@.���[��D����C�v js/admin-article-readmore-es5.js 0000644 00000001741 15173022122 0012513 0 ustar 00 (function () { 'use strict'; /** * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ (function () { var options = window.Joomla.getOptions('xtd-readmore'); window.insertReadmore = function (editor) { if (!options) { // Something went wrong! throw new Error('XTD Button \'read more\' not properly initialized'); } var content = window.Joomla.editors.instances[editor].getValue(); if (!content) { Joomla.editors.instances[editor].replaceSelection('<hr id="system-readmore">'); } else if (content && !content.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)) { Joomla.editors.instances[editor].replaceSelection('<hr id="system-readmore">'); } else { Joomla.renderMessages({ error: [options.exists] }); return false; } return true; }; })(); })(); js/admin-articles-default-batch-footer.min.js.gz 0000644 00000000533 15173022122 0015604 0 ustar 00 � m��N1E�� ��(��)�BA@)��<���$� �$�� Ŀ�)��;�:�J�K�W ���(���;��5FX��µeF�fѕp�b^���x�ٔ�)��--���&8���˛{�Ĉd���&8����rH�!4��*Ȉ0�M�7�i�/<��Xʨ�2�o.��`���(wux�6? ���� �"Q+t0�s�&�K�i�-F>{�y�U�E��a��k��-��(�$Y�z�bi��>c�y��Ǘ�z�"��d=z��o*��[�wκcNq�P�#pMpOB���li�ܳO�)����"�"IJ�콫��O����!��D����J�� js/admin-article-pagebreak.js 0000644 00000001651 15173022122 0012144 0 ustar 00 /** * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ (() => { window.insertPagebreak = editor => { // Get the pagebreak title let title = document.getElementById('title').value; if (!window.parent.Joomla.getOptions('xtd-pagebreak')) { // Something went wrong! window.parent.Joomla.Modal.getCurrent().close(); return false; } // Get the pagebreak toc alias -- not inserting for now don't know which attribute to use.. let alt = document.getElementById('alt').value; title = title !== '' ? `title="${title}"` : ''; alt = alt !== '' ? `alt="${alt}"` : ''; const tag = `<hr class="system-pagebreak" ${title} ${alt}>`; window.parent.Joomla.editors.instances[editor].replaceSelection(tag); window.parent.Joomla.Modal.getCurrent().close(); return false; }; })(); js/form-edit.min.js.gz 0000644 00000000616 15173022122 0010603 0 ustar 00 � mQ�N[1}�WXWJ�K��4�.�X�C� L��!�&���M�ķ�*��)�i���c�����ᛉ�]r���H8���3ܬ)�<��\!3�\�4_W��e4�n��w��G�r���;C!�����K ��ï~ᝁ�;���]p1�G��@&��t�^�[�/<��H���㽉!3D]Yd<��s|ʘ��:� m��������f�$n=u��njE��@�u����C�z}e�S�A�,rL��R���$�IVhm���3��H����$.���lU�r���e�{��OOi7'O�c:�^<����ã���E���{����<Wu��}P�D��'�=��cZқ�s��=�������{ M_�?w�h���/ޔ@k js/articles-status.min.js 0000644 00000000524 15173022122 0011423 0 ustar 00 /** * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */document.addEventListener("DOMContentLoaded",()=>{[].slice.call(document.querySelectorAll(".article-status")).forEach(e=>{e.addEventListener("click",t=>{t.stopPropagation()})})}); js/admin-article-readmore.min.js 0000644 00000001224 15173022122 0012577 0 ustar 00 /** * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */(()=>{const r=window.Joomla.getOptions("xtd-readmore");window.insertReadmore=e=>{if(!r)throw new Error("XTD Button 'read more' not properly initialized");const o=window.Joomla.editors.instances[e].getValue();if(!o)Joomla.editors.instances[e].replaceSelection('<hr id="system-readmore">');else if(o&&!o.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i))Joomla.editors.instances[e].replaceSelection('<hr id="system-readmore">');else return Joomla.renderMessages({error:[r.exists]}),!1;return!0}})(); js/articles-status.min.js.gz 0000644 00000000421 15173022122 0012036 0 ustar 00 � m�OK�@����6�n$Gk�RC)� x*�ͳ]��o_ZK�K�x���0��<�F������n� 5K��- Xw���-�҈ �1,��p���]��N'�Nt�F��+�;�!"