]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Plugin settings forms now use the forms/ directory
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 10 Feb 2011 22:09:40 +0000 (22:09 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 10 Feb 2011 22:09:40 +0000 (22:09 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8093 36083f99-b078-4883-b0ff-0f9b5a30f544

views/default/forms/plugins/settings/save.php [new file with mode: 0644]
views/default/forms/plugins/usersettings/save.php [new file with mode: 0644]
views/default/object/plugin.php

diff --git a/views/default/forms/plugins/settings/save.php b/views/default/forms/plugins/settings/save.php
new file mode 100644 (file)
index 0000000..b2d818e
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Used to show plugin user settings.
+ *
+ * @package Elgg.Core
+ * @subpackage Plugins
+ */
+
+$plugin = $vars['plugin'];
+$plugin_id = $plugin->getID();
+$user_guid = elgg_get_array_value('user_guid', $vars, elgg_get_logged_in_user_guid());
+
+// Do we want to show admin settings or user settings
+$type = elgg_get_array_value('type', $vars, '');
+
+if ($type != 'user') {
+       $type = '';
+}
+
+echo elgg_view("{$type}settings/{$plugin_id}/edit", $vars);
+
+echo "<p>";
+echo elgg_view('input/hidden', array('internalname' => 'plugin_id', 'value' => $plugin_id));
+echo elgg_view('input/hidden', array('internalname' => 'user_guid', 'value' => $user_guid));
+echo elgg_view('input/submit', array('value' => elgg_echo('save'))); 
+echo "</p>";
+
diff --git a/views/default/forms/plugins/usersettings/save.php b/views/default/forms/plugins/usersettings/save.php
new file mode 100644 (file)
index 0000000..8532cdf
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+$vars['type'] = 'user';
+
+echo elgg_view('forms/plugins/settings/save', $vars);
\ No newline at end of file
index b3bb6eb939b4f5a271efd564b88a9ff6998d2037..68171424b23e14fde8282dc3ae3611a50c8367bc 100644 (file)
@@ -4,29 +4,19 @@
  *
  * @package Elgg.Core
  * @subpackage Plugins
+ * 
+ * @todo This view really should be used to display visualization on the admin panel, \
+ * rather than emitting the settings forms
  */
 
-$plugin = $vars['plugin'];
-$plugin_id = $plugin->getID();
-$user_guid = elgg_get_array_value('user_guid', $vars, elgg_get_logged_in_user_guid());
-
 // Do we want to show admin settings or user settings
 $type = elgg_get_array_value('type', $vars, '');
 
-if ($type == 'user') {
-       $view = "{$type}settings/{$plugin_id}/edit";
-       $action = "action/plugins/usersettings/save";
-} else {
-       $view = "settings/{$plugin_id}/edit";
-       $action = "action/plugins/settings/save";
+if ($type != 'user') {
+       $type = '';
 }
 
-$form_body = elgg_view($view, $vars)
-       . "<p>" . elgg_view('input/hidden', array('internalname' => 'plugin_id', 'value' => $plugin_id))
-       . elgg_view('input/hidden', array('internalname' => 'user_guid', 'value' => $user_guid))
-       . elgg_view('input/submit', array('value' => elgg_echo('save'))) . "</p>";
-
 ?>
 <div>
-       <?php echo elgg_view('input/form', array('body' => $form_body, 'action' => $action)); ?>
+       <?php echo elgg_view_form("plugins/{$type}settings/save", array(), $vars); ?>
 </div>
\ No newline at end of file