first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,61 @@
<?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>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
<?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>

View File

@ -0,0 +1,942 @@
<?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="\Joomla\CMS\Component\ComponentHelper::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="300"
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"
/>
<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"
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="\Joomla\CMS\Component\ComponentHelper::filterText"
/>
<field
name="fulltext"
label="COM_CONTENT_FIELD_FULLTEXT"
filter="\Joomla\CMS\Component\ComponentHelper::filterText"
/>
</fields>
</form>

View File

@ -0,0 +1,25 @@
<?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>

View File

@ -0,0 +1,171 @@
<?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>

View File

@ -0,0 +1,150 @@
<?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>

View File

@ -0,0 +1,27 @@
<?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
{
}

View File

@ -0,0 +1,83 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2023 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;
extract($displayData);
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var string $dataAttribute Miscellaneous data attributes preprocessed for HTML output
* @var array $dataAttributes Miscellaneous data attribute for eg, data-*
* @var string $valueTitle
* @var array $canDo
* @var string[] $urls
* @var string[] $modalTitles
* @var string $language
*/
// Do nothing when propagate is disabled
if (empty($canDo['propagate'])) {
return;
}
// Scripts for backward compatibility
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('field.modal-fields');
$wa->addInlineScript(
'window.jSelectArticle_' . $id . ' = function (id, title, catid, object, url, language) {
window.processModalSelect("Article", "' . $id . '", id, title, catid, object, url, language);
}',
['name' => 'inline.select_article_' . $id],
['type' => 'module']
);
Text::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED');
// Language propagate callback name
// Strip off language tag at the end
$tagLength = strlen($language);
$callbackFunctionStem = substr("jSelectArticle_" . $id, 0, -$tagLength);
?>
<button type="button" class="btn btn-primary" <?php echo $value ? '' : 'hidden'; ?>
title="<?php echo $this->escape(Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_TIP')); ?>"
data-show-when-value="1"
onclick="Joomla.propagateAssociation('<?php echo $id; ?>', '<?php echo $callbackFunctionStem; ?>')">
<span class="icon-sync" aria-hidden="true"></span> <?php echo Text::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_BUTTON'); ?>
</button>

View File

@ -0,0 +1,101 @@
<?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&amp;view=articles"
quicktask="index.php?option=com_content&amp;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&amp;view=categories&amp;extension=com_content"
quicktask="index.php?option=com_categories&amp;extension=com_content&amp;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&amp;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&amp;view=workflows&amp;extension=com_content.article"
/>
<menuitem
title="MOD_MENU_FIELDS"
type="component"
element="com_fields"
link="index.php?option=com_fields&amp;view=fields&amp;context=com_content.article"
/>
<menuitem
title="MOD_MENU_FIELDS_GROUP"
type="component"
element="com_fields"
link="index.php?option=com_fields&amp;view=groups&amp;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&amp;view=modules&amp;client_id=0"
quicktask="index.php?option=com_modules&amp;view=select&amp;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&amp;view=modules&amp;client_id=1"
quicktask="index.php?option=com_modules&amp;view=select&amp;client_id=1"
quicktask-title="COM_CONTENT_MENUS_NEW_ADMIN_MODULE"
/>
</menuitem>
</menu>

View File

@ -0,0 +1,68 @@
<?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;
}
);
}
};

View File

@ -0,0 +1,85 @@
<?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', '\\Joomla\\CMS\\Table\\');
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);
}
}
}

View File

@ -0,0 +1,213 @@
<?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';
}
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 5.0.0
*/
public function cancel($key = null)
{
$result = parent::cancel($key);
// When editing in modal then redirect to modalreturn layout
if ($result && $this->input->get('layout') === 'modal') {
$id = $this->input->get('id');
$return = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id)
. '&layout=modalreturn&from-task=cancel';
$this->setRedirect(Route::_($return, false));
}
return $result;
}
/**
* 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));
} elseif ($this->input->get('layout') === 'modal' && $this->task === 'save') {
// When editing in modal then redirect to modalreturn layout
$id = $model->getState('article.id', '');
$return = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($id)
. '&layout=modalreturn&from-task=save';
$this->setRedirect(Route::_($return, 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);
}
}

View File

@ -0,0 +1,160 @@
<?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);
}
}

View File

@ -0,0 +1,67 @@
<?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.
* @see \Joomla\CMS\Filter\InputFilter::clean() for valid values.
*
* @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();
}
}

View File

@ -0,0 +1,127 @@
<?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);
}
}

View File

@ -0,0 +1,87 @@
<?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('_JEXEC') 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 used parameter to true
*
* @param bool $value The value to set
*
* @return void
*
* @since 4.0.0
*/
public function setAbort(string $reason)
{
$this->arguments['abort'] = true;
$this->arguments['abortReason'] = $reason;
}
}

View File

@ -0,0 +1,375 @@
<?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\Schemaorg\SchemaorgServiceInterface;
use Joomla\CMS\Schemaorg\SchemaorgServiceTrait;
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('_JEXEC') 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,
SchemaorgServiceInterface,
WorkflowServiceInterface,
RouterServiceInterface,
TagServiceInterface
{
use AssociationServiceTrait;
use RouterServiceTrait;
use HTMLRegistryAwareTrait;
use WorkflowServiceTrait;
use SchemaorgServiceTrait;
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 for schemaorg
*
* @return array
*
* @since 5.0.0
*/
public function getSchemaorgContexts(): array
{
Factory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);
$contexts = [
'com_content.article' => Text::_('COM_CONTENT'),
];
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';
}
if ($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);
}
}

View File

@ -0,0 +1,59 @@
<?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);
}
}

View File

@ -0,0 +1,189 @@
<?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\Field\ModalSelectField;
use Joomla\CMS\Language\LanguageHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
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 ModalSelectField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Modal_Article';
/**
* 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.
*
* @return boolean True on success.
*
* @see FormField::setup()
* @since 5.0.0
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
{
// Check if the value consist with id:alias, extract the id only
if ($value && str_contains($value, ':')) {
[$id] = explode(':', $value, 2);
$value = (int) $id;
}
$result = parent::setup($element, $value, $group);
if (!$result) {
return $result;
}
Factory::getApplication()->getLanguage()->load('com_content', JPATH_ADMINISTRATOR);
$languages = LanguageHelper::getContentLanguages([0, 1], false);
$language = (string) $this->element['language'];
// Prepare enabled actions
$this->canDo['propagate'] = ((string) $this->element['propagate'] == 'true') && \count($languages) > 2;
// Prepare Urls
$linkArticles = (new Uri())->setPath(Uri::base(true) . '/index.php');
$linkArticles->setQuery([
'option' => 'com_content',
'view' => 'articles',
'layout' => 'modal',
'tmpl' => 'component',
Session::getFormToken() => 1,
]);
$linkArticle = clone $linkArticles;
$linkArticle->setVar('view', 'article');
$linkCheckin = (new Uri())->setPath(Uri::base(true) . '/index.php');
$linkCheckin->setQuery([
'option' => 'com_content',
'task' => 'articles.checkin',
'format' => 'json',
Session::getFormToken() => 1,
]);
if ($language) {
$linkArticles->setVar('forcedLanguage', $language);
$linkArticle->setVar('forcedLanguage', $language);
$modalTitle = Text::_('COM_CONTENT_SELECT_AN_ARTICLE') . ' &#8212; ' . $this->getTitle();
$this->dataAttributes['data-language'] = $language;
} else {
$modalTitle = Text::_('COM_CONTENT_SELECT_AN_ARTICLE');
}
$urlSelect = $linkArticles;
$urlEdit = clone $linkArticle;
$urlEdit->setVar('task', 'article.edit');
$urlNew = clone $linkArticle;
$urlNew->setVar('task', 'article.add');
$this->urls['select'] = (string) $urlSelect;
$this->urls['new'] = (string) $urlNew;
$this->urls['edit'] = (string) $urlEdit;
$this->urls['checkin'] = (string) $linkCheckin;
// Prepare titles
$this->modalTitles['select'] = $modalTitle;
$this->modalTitles['new'] = Text::_('COM_CONTENT_NEW_ARTICLE');
$this->modalTitles['edit'] = Text::_('COM_CONTENT_EDIT_ARTICLE');
$this->hint = $this->hint ?: Text::_('COM_CONTENT_SELECT_AN_ARTICLE');
return $result;
}
/**
* Method to retrieve the title of selected item.
*
* @return string
*
* @since 5.0.0
*/
protected function getValueTitle()
{
$value = (int) $this->value ?: '';
$title = '';
if ($value) {
try {
$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);
$title = $db->loadResult();
} catch (\Throwable $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
}
return $title ?: $value;
}
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 5.0.0
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
$data['language'] = (string) $this->element['language'];
return $data;
}
/**
* Get the renderer
*
* @param string $layoutId Id to load
*
* @return FileLayout
*
* @since 5.0.0
*/
protected function getRenderer($layoutId = 'default')
{
$layout = parent::getRenderer($layoutId);
$layout->setComponent('com_content');
$layout->setClient(1);
return $layout;
}
}

View File

@ -0,0 +1,57 @@
<?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 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);
}
}

View File

@ -0,0 +1,57 @@
<?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 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);
}
}

View File

@ -0,0 +1,206 @@
<?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,
];
}
}

View File

@ -0,0 +1,191 @@
<?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;
}
if ($workflow_id === 'use_default') {
break;
}
if ($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']);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,661 @@
<?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', '\\Joomla\\CMS\\Table\\');
$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;
}
}

View File

@ -0,0 +1,53 @@
<?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 [];
}
}

View File

@ -0,0 +1,103 @@
<?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;
}
}

View File

@ -0,0 +1,106 @@
<?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;
}
}

View File

@ -0,0 +1,155 @@
<?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>';
}
}

View File

@ -0,0 +1,24 @@
<?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('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Article table
*
* @since 1.5
*/
class ArticleTable extends \Joomla\CMS\Table\Content
{
}

View File

@ -0,0 +1,40 @@
<?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;
use Joomla\Event\DispatcherInterface;
// 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
* @param ?DispatcherInterface $dispatcher Event dispatcher for this table
*
* @since 1.6
*/
public function __construct(DatabaseDriver $db, DispatcherInterface $dispatcher = null)
{
parent::__construct('#__content_frontpage', 'content_id', $db, $dispatcher);
}
}

View File

@ -0,0 +1,276 @@
<?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\Registry\Registry
*/
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);
if ($this->getLayout() === 'modalreturn') {
parent::display($tpl);
return;
}
// 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);
}
if ($this->getLayout() !== 'modal') {
$this->addToolbar();
} else {
$this->addModalToolbar();
}
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');
}
/**
* Add the modal toolbar.
*
* @return void
*
* @since 5.0.0
*
* @throws \Exception
*/
protected function addModalToolbar()
{
$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();
// Build 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'
);
$canCreate = $isNew && (\count($user->getAuthorisedCategories('com_content', 'core.create')) > 0);
$canEdit = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId);
// For new records, check the create permission.
if ($canCreate || $canEdit) {
$toolbar->apply('article.apply');
$toolbar->save('article.save');
}
$toolbar->cancel('article.cancel');
}
}

View File

@ -0,0 +1,261 @@
<?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\Registry\Registry
*/
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 (\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')
&& $user->authorise('core.execute.transition', 'com_content')
) {
$childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->popupType('inline')
->textHeader(Text::_('COM_CONTENT_BATCH_OPTIONS'))
->url('#joomla-dialog-batch')
->modalWidth('800px')
->modalHeight('fit-content')
->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');
}
}

View File

@ -0,0 +1,207 @@
<?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\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\Registry\Registry
*/
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 = $this->getCurrentUser();
$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');
}
}

View File

@ -0,0 +1,187 @@
<?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 = $input->get('tmpl');
$tmpl = $tmpl ? '&tmpl=' . $tmpl : '';
?>
<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>

View File

@ -0,0 +1,17 @@
<?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>

View File

@ -0,0 +1,19 @@
<?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="subhead noshadow mb-3">
<?php echo $this->document->getToolbar('toolbar')->render(); ?>
</div>
<div class="container-popup">
<?php $this->setLayout('edit'); ?>
<?php echo $this->loadTemplate(); ?>
</div>

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_content
*
* @copyright (C) 2023 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\Component\Content\Site\Helper\RouteHelper;
$icon = 'icon-check';
$title = $this->item ? $this->item->title : '';
$content = $this->item ? $this->item->alias : '';
$data = ['contentType' => 'com_content.article'];
if ($this->item) {
$data['id'] = $this->item->id;
$data['title'] = $this->item->title;
$data['catId'] = $this->item->catid;
$data['uri'] = RouteHelper::getArticleRoute($this->item->id, $this->item->catid, $this->item->language);
}
// Add Content select script
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
$wa->useScript('modal-content-select');
// The data for Content select script
$this->document->addScriptOptions('content-select-on-load', $data, false);
?>
<div class="px-4 py-5 my-5 text-center">
<span class="fa-8x mb-4 <?php echo $icon; ?>" aria-hidden="true"></span>
<h1 class="display-5 fw-bold"><?php echo $title; ?></h1>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4">
<?php echo $content; ?>
</p>
</div>
</div>

View File

@ -0,0 +1,49 @@
<?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>

View File

@ -0,0 +1,392 @@
<?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 = $this->getCurrentUser();
$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;
$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-draggable-group="<?php echo $item->catid; ?>"
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 || $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 ' &#187; ';
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 ' &#171; ';
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 ' &#187; ';
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')
) : ?>
<template id="joomla-dialog-batch"><?php echo $this->loadTemplate('batch_body'); ?></template>
<?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>

View File

@ -0,0 +1,104 @@
<?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="filter"
label="COM_MENUS_ADMIN_FILTER_LABEL"
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&amp;task=article.add">JSHOW</option>
</field>
<field
name="menu-quicktask-title"
type="hidden"
default="COM_CONTENT_MENUS_NEW_ARTICLE"
/>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,66 @@
<?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\Language\Multilanguage;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
$params = ComponentHelper::getParams('com_content');
$published = (int) $this->state->get('filter.published');
$user = $this->getCurrentUser();
?>
<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>
<div class="btn-toolbar p-3">
<joomla-toolbar-button task="article.batch" class="ms-auto">
<button type="button" class="btn btn-success"><?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?></button>
</joomla-toolbar-button>
</div>

View File

@ -0,0 +1,28 @@
<?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\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 = $this->getCurrentUser();
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);

View File

@ -0,0 +1,174 @@
<?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('modal-content-select')
->useScript('com_content.admin-articles-modal');
// @todo: Use of Function and Editor is deprecated and should be removed in 6.0. It stays only for backward compatibility.
$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-times',
1 => 'icon-check',
];
?>
<?php foreach ($this->items as $i => $item) : ?>
<?php
$lang = '';
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);
}
}
$link = RouteHelper::getArticleRoute($item->id, $item->catid, $item->language);
$itemHtml = '<a href="' . $this->escape($link) . '"' . ($lang ? ' hreflang="' . $lang . '"' : '') . '>' . $item->title . '</a>';
?>
<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-content-select data-content-type="com_content.article"'
. '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($link) . '"'
. ' data-language="' . $this->escape($lang) . '"'
. ' data-html="' . $this->escape($itemHtml) . '"';
?>
<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>

View File

@ -0,0 +1,398 @@
<?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 = $this->getCurrentUser();
$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.runTransitions'
];
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 ' &#187; ';
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 ' &#171; ';
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 ' &#187; ';
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>

View File

@ -0,0 +1,8 @@
<?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>

View File

@ -0,0 +1,25 @@
<?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>

View File

@ -0,0 +1,25 @@
<?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>

View File

@ -0,0 +1,27 @@
<?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\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 = $this->getCurrentUser();
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);