summaryrefslogtreecommitdiff
path: root/plugins/example
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-05-07 10:09:38 +0400
committerAndrew Dolgov <[email protected]>2013-05-07 10:09:38 +0400
commit2c967d60237c5890549b9c9fa680ee7adec10e6a (patch)
treee59a6791d97715b17bd08129f309227178999655 /plugins/example
parentd88922a5d31062196da6e69ab109079cda8867b2 (diff)
move example plugins to -contrib
Diffstat (limited to 'plugins/example')
-rw-r--r--plugins/example/example.js3
-rw-r--r--plugins/example/init.php85
2 files changed, 0 insertions, 88 deletions
diff --git a/plugins/example/example.js b/plugins/example/example.js
deleted file mode 100644
index a31f2c2a2..000000000
--- a/plugins/example/example.js
+++ /dev/null
@@ -1,3 +0,0 @@
-function example(value) {
- alert("Value saved: " + value);
-}
diff --git a/plugins/example/init.php b/plugins/example/init.php
deleted file mode 100644
index 67f502778..000000000
--- a/plugins/example/init.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-class Example extends Plugin {
-
- // Demonstrates how to add a separate panel to the preferences screen and inject Javascript/save data using Dojo forms.
- private $host;
-
- function about() {
- return array(1.0,
- "Example plugin #1",
- "fox",
- true,
- "http://site.com");
- }
-
- function init($host) {
- $this->host = $host;
-
- $host->add_hook($host::HOOK_PREFS_TAB, $this);
- }
-
- function save() {
- $example_value = db_escape_string($_POST["example_value"]);
-
- $this->host->set($this, "example", $example_value);
-
- echo "Value set to $example_value";
- }
-
- function get_prefs_js() {
- return file_get_contents(dirname(__FILE__) . "/example.js");
- }
-
- function hook_prefs_tab($args) {
- if ($args != "prefPrefs") return;
-
- print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__("Example Pane")."\">";
-
- print "<br/>";
-
-// print_r($this->host->set($this, "example", rand(0,100)));
-// print_r($this->host->get_all($this));
-
- $value = $this->host->get($this, "example");
-
- print "<form dojoType=\"dijit.form.Form\">";
-
- print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
- evt.preventDefault();
- if (this.validate()) {
- console.log(dojo.objectToQuery(this.getValues()));
- new Ajax.Request('backend.php', {
- parameters: dojo.objectToQuery(this.getValues()),
- onComplete: function(transport) {
- notify_info(transport.responseText);
- }
- });
- //this.reset();
- }
- </script>";
-
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
- print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"example\">";
-
- print "<table width=\"100%\" class=\"prefPrefsList\">";
-
- print "<tr><td width=\"40%\">".__("Sample value")."</td>";
- print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"example_value\" value=\"$value\"></td></tr>";
-
- print "</table>";
-
- print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
- __("Set value")."</button>";
-
- print "</form>";
-
- print "</div>"; #pane
- }
-
- function api_version() {
- return 2;
- }
-
-}
-?>