Allow multiple authorship for entries
This commit is contained in:
parent
c1b84508ea
commit
efeede599b
docs
plugins/serendipity_event_entryproperties
@ -1,6 +1,9 @@
|
|||||||
Version 2.x.x (major) ()
|
Version 2.x.x (major) ()
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* Updated entryproperties plugin to support a custom property for
|
||||||
|
multiple ownership of an article
|
||||||
|
|
||||||
* Emit and detect rel=trackback element to find trackback
|
* Emit and detect rel=trackback element to find trackback
|
||||||
url, to have a reliable alternative to RDF used so far
|
url, to have a reliable alternative to RDF used so far
|
||||||
|
|
||||||
|
@ -45,3 +45,4 @@
|
|||||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE', 'Reihenfolge der Optionen');
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE', 'Reihenfolge der Optionen');
|
||||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE_DESC', 'Hier kann ausgewählt werden, welche Optionen in welcher Reihenfolge im Editiermodus des Artikels angezeigt werden.');
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE_DESC', 'Hier kann ausgewählt werden, welche Optionen in welcher Reihenfolge im Editiermodus des Artikels angezeigt werden.');
|
||||||
|
|
||||||
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_MULTI_AUTHORS', 'Mehrere Autoren');
|
||||||
|
@ -44,3 +44,4 @@
|
|||||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE', 'Reihenfolge der Optionen');
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE', 'Reihenfolge der Optionen');
|
||||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE_DESC', 'Hier kann ausgewählt werden, welche Optionen in welcher Reihenfolge im Editiermodus des Artikels angezeigt werden.');
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE_DESC', 'Hier kann ausgewählt werden, welche Optionen in welcher Reihenfolge im Editiermodus des Artikels angezeigt werden.');
|
||||||
|
|
||||||
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_MULTI_AUTHORS', 'Mehrere Autoren');
|
@ -44,3 +44,4 @@
|
|||||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE', 'Entry editing screen');
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE', 'Entry editing screen');
|
||||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE_DESC', 'Here you can choose, which elements and in which order the plugin should show its input fields in the entry editing process.');
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_SEQUENCE_DESC', 'Here you can choose, which elements and in which order the plugin should show its input fields in the entry editing process.');
|
||||||
|
|
||||||
|
@define('PLUGIN_EVENT_ENTRYPROPERTIES_MULTI_AUTHORS', 'Multiple authors');
|
@ -19,7 +19,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
$propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC);
|
$propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC);
|
||||||
$propbag->add('stackable', false);
|
$propbag->add('stackable', false);
|
||||||
$propbag->add('author', 'Garvin Hicking');
|
$propbag->add('author', 'Garvin Hicking');
|
||||||
$propbag->add('version', '1.40');
|
$propbag->add('version', '1.41');
|
||||||
$propbag->add('requirements', array(
|
$propbag->add('requirements', array(
|
||||||
'serendipity' => '1.6',
|
'serendipity' => '1.6',
|
||||||
'smarty' => '2.6.27',
|
'smarty' => '2.6.27',
|
||||||
@ -113,11 +113,12 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
'groups' => array('display' => PERM_READ . ': ' . GROUP),
|
'groups' => array('display' => PERM_READ . ': ' . GROUP),
|
||||||
'authors' => array('display' => PERM_READ . ': ' . AUTHOR),
|
'authors' => array('display' => PERM_READ . ': ' . AUTHOR),
|
||||||
'author' => array('display' => AUTHOR),
|
'author' => array('display' => AUTHOR),
|
||||||
|
'multi_authors'=> array('display' => PLUGIN_EVENT_ENTRYPROPERTIES_MULTI_AUTHORS),
|
||||||
'markup' => array('display' => PLUGIN_EVENT_ENTRYPROPERTIES_DISABLE_MARKUP),
|
'markup' => array('display' => PLUGIN_EVENT_ENTRYPROPERTIES_DISABLE_MARKUP),
|
||||||
'customfields' => array('display' => PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS),
|
'customfields' => array('display' => PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS),
|
||||||
);
|
);
|
||||||
$propbag->add('values', $values);
|
$propbag->add('values', $values);
|
||||||
$propbag->add('default', 'sticky,frontpage,hiderss,access,password,groups,authors,author,markup');
|
$propbag->add('default', 'sticky,frontpage,hiderss,access,password,groups,authors,author,multi_authors,markup');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -172,7 +173,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
static $supported_properties = null;
|
static $supported_properties = null;
|
||||||
|
|
||||||
if ($supported_properties === null) {
|
if ($supported_properties === null) {
|
||||||
$supported_properties = array('is_sticky', 'access', 'access_groups', 'access_users', 'cache_body', 'cache_extended', 'no_frontpage', 'hiderss', 'entrypassword');
|
$supported_properties = array('is_sticky', 'access', 'access_groups', 'access_users', 'multi_authors', 'cache_body', 'cache_extended', 'no_frontpage', 'hiderss', 'entrypassword');
|
||||||
|
|
||||||
// Capture special characters for "," and ":"
|
// Capture special characters for "," and ":"
|
||||||
$special_from = array('\\,', '\\:');
|
$special_from = array('\\,', '\\:');
|
||||||
@ -403,6 +404,41 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'multi_authors':
|
||||||
|
?>
|
||||||
|
<div class="entryproperties_access_author adv_opts_box form_multiselect">
|
||||||
|
<label for="properties_access_multi_authors"><?php echo PLUGIN_EVENT_ENTRYPROPERTIES_MULTI_AUTHORS; ?></label>
|
||||||
|
<select id="properties_access_multi_authors" name="serendipity[properties][multi_authors][]" multiple="multiple">
|
||||||
|
<?php
|
||||||
|
if (isset($serendipity['POST']['properties']['multi_authors'])) {
|
||||||
|
$counter_multi_authors = 0;
|
||||||
|
foreach($serendipity['POST']['properties']['multi_authors'] as $user) {
|
||||||
|
$selected_users[$counter_multi_authors] = $user;
|
||||||
|
$counter_multi_authors++;
|
||||||
|
}
|
||||||
|
} elseif (!empty($eventData['properties']['ep_multi_authors'])) {
|
||||||
|
$counter_multi_authors = 0;
|
||||||
|
foreach($eventData['properties']['ep_multi_authors'] as $user) {
|
||||||
|
$selected_users[$counter_multi_authors] = $user['author_id'];
|
||||||
|
$counter_multi_authors++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$selected_users = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$avail_users =& $this->getValidAuthors();
|
||||||
|
|
||||||
|
echo '<option value="">- - -</option>' . "\n";
|
||||||
|
|
||||||
|
foreach($avail_users AS $user) {
|
||||||
|
echo '<option value="' . $user['authorid'] . '" ' . (in_array($user['authorid'], $selected_users) ? ' selected="selected"' : '') . '>' . htmlspecialchars($user['realname']) . '</option>' . "\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
|
|
||||||
case 'author':
|
case 'author':
|
||||||
?>
|
?>
|
||||||
<div class="entryproperties_access_author adv_opts_box form_select">
|
<div class="entryproperties_access_author adv_opts_box form_select">
|
||||||
@ -586,6 +622,15 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
$access_groups = array();
|
$access_groups = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($eventData['properties']['ep_multi_authors'])) {
|
||||||
|
//$eventData['properties']['ep_multi_authors'] = explode(';', $eventData['properties']['ep_multi_authors']);
|
||||||
|
} elseif (isset($serendipity['POST']['properties']['multi_authors'])) {
|
||||||
|
//$serendipity['POST']['properties']['multi_authors'] = explode(';', $serendipity['properties']['ep_multi_authors']);
|
||||||
|
$eventData['properties']['ep_multi_authors'] = $serendipity['POST']['properties']['multi_authors'];
|
||||||
|
} else {
|
||||||
|
$eventData['properties']['ep_multi_authors'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($eventData['properties']['ep_access_users'])) {
|
if (isset($eventData['properties']['ep_access_users'])) {
|
||||||
$access_users = explode(';', $eventData['properties']['ep_access_users']);
|
$access_users = explode(';', $eventData['properties']['ep_access_users']);
|
||||||
} elseif (isset($serendipity['POST']['properties']['access_users'])) {
|
} elseif (isset($serendipity['POST']['properties']['access_users'])) {
|
||||||
@ -768,7 +813,20 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach($properties AS $idx => $row) {
|
foreach($properties AS $idx => $row) {
|
||||||
$eventData[$addData[$row['entryid']]]['properties'][$row['property']] = $row['value'];
|
if ($row['property'] == "ep_multi_authors") {
|
||||||
|
$tmp = explode(";", $row['value']);
|
||||||
|
$counter = 0;
|
||||||
|
unset($eventData[$addData[$row['entryid']]]['properties'][$row['property']]);
|
||||||
|
foreach($tmp as $key => $value) {
|
||||||
|
$tmp_author_array = serendipity_fetchAuthor($value);
|
||||||
|
$eventData[$addData[$row['entryid']]]['properties'][$row['property']][$counter]['author_id'] = $value;
|
||||||
|
$eventData[$addData[$row['entryid']]]['properties'][$row['property']][$counter]['author_name'] = $tmp_author_array[0]['realname'];
|
||||||
|
$eventData[$addData[$row['entryid']]]['properties'][$row['property']][$counter]['author_url'] = serendipity_authorURL($tmp_author_array[0]);
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$eventData[$addData[$row['entryid']]]['properties'][$row['property']] = $row['value'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user