aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/blog/actions/blog/save.php4
-rw-r--r--mod/embed/start.php2
-rw-r--r--mod/groups/lib/groups.php62
-rw-r--r--mod/groups/views/default/forms/groups/edit.php48
-rw-r--r--mod/groups/views/default/groups/edit.php4
-rw-r--r--mod/pages/views/default/pages/icon.php2
-rw-r--r--mod/thewire/views/default/js/thewire.php16
-rw-r--r--mod/thewire/views/default/thewire/css.php3
8 files changed, 90 insertions, 51 deletions
diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php
index 8923cd0d2..048bc00be 100644
--- a/mod/blog/actions/blog/save.php
+++ b/mod/blog/actions/blog/save.php
@@ -145,7 +145,7 @@ if (!$error) {
// add to river if changing status or published, regardless of new post
// because we remove it for drafts.
if (($new_post || $old_status == 'draft') && $status == 'published') {
- add_to_river('river/object/blog/create', 'create', elgg_get_logged_in_user_guid(), $blog->getGUID());
+ add_to_river('river/object/blog/create', 'create', $blog->owner_guid, $blog->getGUID());
if ($guid) {
$blog->time_created = time();
@@ -170,4 +170,4 @@ if (!$error) {
} else {
register_error($error);
forward($error_forward_url);
-} \ No newline at end of file
+}
diff --git a/mod/embed/start.php b/mod/embed/start.php
index a3ccab66b..e8a3f8c14 100644
--- a/mod/embed/start.php
+++ b/mod/embed/start.php
@@ -47,7 +47,7 @@ function embed_longtext_menu($hook, $type, $items, $vars) {
'name' => 'embed',
'href' => $url,
'text' => elgg_echo('embed:media'),
- 'rel' => 'lightbox',
+ 'rel' => "embed-lightbox-{$vars['id']}",
'link_class' => "elgg-longtext-control elgg-lightbox embed-control embed-control-{$vars['id']}",
'priority' => 10,
));
diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php
index dfbb1154b..505cacd01 100644
--- a/mod/groups/lib/groups.php
+++ b/mod/groups/lib/groups.php
@@ -497,3 +497,65 @@ function groups_register_profile_buttons($group) {
}
}
}
+
+/**
+ * Prepares variables for the group edit form view.
+ *
+ * @param mixed $group ElggGroup or null. If a group, uses values from the group.
+ * @return array
+ */
+function groups_prepare_form_vars($group = null) {
+ $values = array(
+ 'name' => '',
+ 'membership' => ACCESS_PUBLIC,
+ 'vis' => ACCESS_PUBLIC,
+ 'guid' => null,
+ 'entity' => null
+ );
+
+ // handle customizable profile fields
+ $fields = elgg_get_config('group');
+
+ if ($fields) {
+ foreach ($fields as $name => $type) {
+ $values[$name] = '';
+ }
+ }
+
+ // handle tool options
+ $tools = elgg_get_config('group_tool_options');
+ if ($tools) {
+ foreach ($tools as $group_option) {
+ $option_name = $group_option->name . "_enable";
+ $values[$option_name] = $group_option->default_on ? 'yes' : 'no';
+ }
+ }
+
+ // get current group settings
+ if ($group) {
+ foreach (array_keys($values) as $field) {
+ if (isset($group->$field)) {
+ $values[$field] = $group->$field;
+ }
+ }
+
+ if ($group->access_id != ACCESS_PUBLIC && $group->access_id != ACCESS_LOGGED_IN) {
+ // group only access - this is done to handle access not created when group is created
+ $values['vis'] = ACCESS_PRIVATE;
+ }
+
+ $values['entity'] = $group;
+ }
+
+ // get any sticky form settings
+ if (elgg_is_sticky_form('groups')) {
+ $sticky_values = elgg_get_sticky_values('groups');
+ foreach ($sticky_values as $key => $value) {
+ $values[$key] = $value;
+ }
+ }
+
+ elgg_clear_sticky_form('groups');
+
+ return $values;
+}
diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php
index 7540d1bf9..532e89c35 100644
--- a/mod/groups/views/default/forms/groups/edit.php
+++ b/mod/groups/views/default/forms/groups/edit.php
@@ -5,26 +5,9 @@
* @package ElggGroups
*/
-if (elgg_is_sticky_form('groups')) {
- $sticky_values = elgg_get_sticky_values('groups');
- elgg_clear_sticky_form('groups');
-}
-
-// new groups default to open membership
-if (isset($sticky_values)) {
- $membership = $sticky_values['membership'];
- $access = $sticky_values['access_id'];
-} elseif (isset($vars['entity'])) {
- $membership = $vars['entity']->membership;
- $access = $vars['entity']->access_id;
- if ($access != ACCESS_PUBLIC && $access != ACCESS_LOGGED_IN) {
- // group only - this is done to handle access not created when group is created
- $access = ACCESS_PRIVATE;
- }
-} else {
- $membership = ACCESS_PUBLIC;
- $access = ACCESS_PUBLIC;
-}
+// only extract these elements.
+$name = $membership = $vis = $entity = null;
+extract($vars, EXTR_IF_EXISTS);
?>
<div>
@@ -35,7 +18,7 @@ if (isset($sticky_values)) {
<label><?php echo elgg_echo("groups:name"); ?></label><br />
<?php echo elgg_view("input/text", array(
'name' => 'name',
- 'value' => isset($sticky_values['name']) ? $sticky_values['name'] : $vars['entity']->name,
+ 'value' => $name
));
?>
</div>
@@ -53,7 +36,7 @@ if ($group_profile_fields > 0) {
echo "</label>$line_break";
echo elgg_view("input/{$valtype}", array(
'name' => $shortname,
- 'value' => isset($sticky_values[$shortname]) ? $sticky_values[$shortname] : $vars['entity']->$shortname,
+ 'value' => elgg_extract($shortname, $vars)
));
echo '</div>';
}
@@ -78,10 +61,6 @@ if ($group_profile_fields > 0) {
<?php
if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
- $this_owner = $vars['entity']->owner_guid;
- if (!$this_owner) {
- $this_owner = elgg_get_logged_in_user_guid();
- }
$access_options = array(
ACCESS_PRIVATE => elgg_echo('groups:access:group'),
ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
@@ -94,7 +73,7 @@ if (elgg_get_plugin_setting('hidden_groups', 'groups') == 'yes') {
<?php echo elgg_echo('groups:visibility'); ?><br />
<?php echo elgg_view('input/access', array(
'name' => 'vis',
- 'value' => $access,
+ 'value' => $vis,
'options_values' => $access_options,
));
?>
@@ -109,12 +88,7 @@ if ($tools) {
usort($tools, create_function('$a,$b', 'return strcmp($a->label,$b->label);'));
foreach ($tools as $group_option) {
$group_option_toggle_name = $group_option->name . "_enable";
- if ($group_option->default_on) {
- $group_option_default_value = 'yes';
- } else {
- $group_option_default_value = 'no';
- }
- $value = $vars['entity']->$group_option_toggle_name ? $vars['entity']->$group_option_toggle_name : $group_option_default_value;
+ $value = elgg_extract($group_option_toggle_name, $vars);
?>
<div>
<label>
@@ -137,17 +111,17 @@ if ($tools) {
<div class="elgg-foot">
<?php
-if (isset($vars['entity'])) {
+if (isset($entity)) {
echo elgg_view('input/hidden', array(
'name' => 'group_guid',
- 'value' => $vars['entity']->getGUID(),
+ 'value' => $entity->getGUID(),
));
}
echo elgg_view('input/submit', array('value' => elgg_echo('save')));
-if (isset($vars['entity'])) {
- $delete_url = 'action/groups/delete?guid=' . $vars['entity']->getGUID();
+if (isset($entity)) {
+ $delete_url = 'action/groups/delete?guid=' . $entity->getGUID();
echo elgg_view('output/confirmlink', array(
'text' => elgg_echo('groups:delete'),
'href' => $delete_url,
diff --git a/mod/groups/views/default/groups/edit.php b/mod/groups/views/default/groups/edit.php
index 24a1c3f1e..5579ad54a 100644
--- a/mod/groups/views/default/groups/edit.php
+++ b/mod/groups/views/default/groups/edit.php
@@ -11,5 +11,5 @@ $form_vars = array(
'enctype' => 'multipart/form-data',
'class' => 'elgg-form-alt',
);
-$body_vars = array('entity' => $entity);
-echo elgg_view_form('groups/edit', $form_vars, $body_vars);
+
+echo elgg_view_form('groups/edit', $form_vars, groups_prepare_form_vars($entity));
diff --git a/mod/pages/views/default/pages/icon.php b/mod/pages/views/default/pages/icon.php
index d3b749eb8..cba034ec4 100644
--- a/mod/pages/views/default/pages/icon.php
+++ b/mod/pages/views/default/pages/icon.php
@@ -21,5 +21,5 @@ if (!in_array($vars['size'], array('small', 'medium', 'large', 'tiny', 'master',
?>
<a href="<?php echo $annotation->getURL(); ?>">
- <img src="<?php echo $entity->getIconURL($vars['size']); ?>" />
+ <img alt="<?php echo $entity->title; ?>" src="<?php echo $entity->getIconURL($vars['size']); ?>" />
</a>
diff --git a/mod/thewire/views/default/js/thewire.php b/mod/thewire/views/default/js/thewire.php
index 0a6eba134..ba8f35050 100644
--- a/mod/thewire/views/default/js/thewire.php
+++ b/mod/thewire/views/default/js/thewire.php
@@ -34,11 +34,11 @@ elgg.thewire.textCounter = function(textarea, status, limit) {
status.html(remaining_chars);
if (remaining_chars < 0) {
- status.parent().css("color", "#D40D12");
+ status.parent().addClass("thewire-characters-remaining-warning");
$("#thewire-submit-button").attr('disabled', 'disabled');
$("#thewire-submit-button").addClass('elgg-state-disabled');
} else {
- status.parent().css("color", "");
+ status.parent().removeClass("thewire-characters-remaining-warning");
$("#thewire-submit-button").removeAttr('disabled', 'disabled');
$("#thewire-submit-button").removeClass('elgg-state-disabled');
}
@@ -57,16 +57,16 @@ elgg.thewire.viewPrevious = function(event) {
var postGuid = $link.attr("href").split("/").pop();
var $previousDiv = $("#thewire-previous-" + postGuid);
- if ($link.html() == "<?php echo elgg_echo('thewire:hide'); ?>") {
- $link.html("<?php echo elgg_echo('thewire:previous'); ?>");
- $link.attr("title", "<?php echo elgg_echo('thewire:previous:help'); ?>");
+ if ($link.html() == elgg.echo('thewire:hide')) {
+ $link.html(elgg.echo('thewire:previous'));
+ $link.attr("title", elgg.echo('thewire:previous:help'));
$previousDiv.slideUp(400);
} else {
- $link.html("<?php echo elgg_echo('thewire:hide'); ?>");
- $link.attr("title", "<?php echo elgg_echo('thewire:hide:help'); ?>");
+ $link.html(elgg.echo('thewire:hide'));
+ $link.attr("title", elgg.echo('thewire:hide:help'));
$.ajax({type: "GET",
- url: "<?php echo $site_url . "ajax/view/thewire/previous"; ?>",
+ url: elgg.config.wwwroot + "ajax/view/thewire/previous",
dataType: "html",
cache: false,
data: {guid: postGuid},
diff --git a/mod/thewire/views/default/thewire/css.php b/mod/thewire/views/default/thewire/css.php
index d1ef31993..d11cce74a 100644
--- a/mod/thewire/views/default/thewire/css.php
+++ b/mod/thewire/views/default/thewire/css.php
@@ -27,6 +27,9 @@ The Wire
text-align: right;
background: white;
}
+.thewire-characters-remaining-warning {
+ color: #D40D12 !important;
+}
.thewire-parent {
margin-left: 40px;
}