save owncloud url as plugin pref

This commit is contained in:
Thomas Renard 2012-12-28 00:57:36 +01:00
parent 7e8b6f32cb
commit 7278dc0edf
1 changed files with 6 additions and 10 deletions

View File

@ -38,7 +38,7 @@ class OwnCloud extends Plugin {
function hook_prefs_tab($args) { function hook_prefs_tab($args) {
if ($args != "prefPrefs") return; if ($args != "prefPrefs") return;
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__("Owncloud Pane")."\">"; print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__("Owncloud")."\">";
print "<br/>"; print "<br/>";
@ -46,9 +46,9 @@ class OwnCloud extends Plugin {
print "<form dojoType=\"dijit.form.Form\">"; print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.prefentDefault(); evt.preventDefault();
if (this.validate()) { if (this.validate()) {
console.log(dojo.objectToQuery(this.getValiues())); console.log(dojo.objectToQuery(this.getValues()));
new Ajax.Request('backend.php', { new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()), parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) { onComplete: function(transport) {
@ -60,13 +60,12 @@ class OwnCloud extends Plugin {
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">"; 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=\"method\" value=\"save\">";
print "<input dojoType=\"dijit.from.TextBox\" style=\"display : none\" name=\"plugin\" value=\"owncloud\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"owncloud\">";
print "<table width=\"100%\" class=\"prefPrefsList\">"; print "<table width=\"100%\" class=\"prefPrefsList\">";
print "<tr><td width=\"40%\">".__("Owncloud url")."</td>"; print "<tr><td width=\"40%\">".__("Owncloud url")."</td>";
print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"owncloud_url\" value=\"$value\"></td></tr>"; print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"owncloud_url\" value=\"$value\"></td></tr>";
print "</table>"; print "</table>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">". print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".__("Set value")."</button>";
__("Set value")."</button>";
print "</form>"; print "</form>";
@ -94,10 +93,7 @@ class OwnCloud extends Plugin {
$article_link = db_fetch_result($result, 0, 'link'); $article_link = db_fetch_result($result, 0, 'link');
} }
$own_url = ""; $own_url = $this->host->get($this, "owncloud");
if (defined('OWNCLOUD_URL')) {
$own_url = OWNCLOUD_URL;
}
print json_encode(array("title" => $title, "link" => $article_link, print json_encode(array("title" => $title, "link" => $article_link,
"id" => $id, "ownurl" => $own_url)); "id" => $id, "ownurl" => $own_url));