From 27df8ca4628457e2fca13a64125152469dab33bb Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Mon, 23 Jul 2012 10:43:53 -0400 Subject: dialog for opml importing --- ajax/feeddialog.php | 4 +-- ajax/folderdialog.php | 4 +-- ajax/importdialog.php | 4 +++ js/settings.js | 55 +++++++++++++++++++++++++++-------------- opmlparser.php | 15 +++++++++++ templates/part.importdialog.php | 6 +++++ templates/settings.php | 10 +++++--- 7 files changed, 73 insertions(+), 25 deletions(-) create mode 100644 ajax/importdialog.php create mode 100644 opmlparser.php create mode 100644 templates/part.importdialog.php diff --git a/ajax/feeddialog.php b/ajax/feeddialog.php index c42771c98..b1e41a6ff 100644 --- a/ajax/feeddialog.php +++ b/ajax/feeddialog.php @@ -3,5 +3,5 @@ include("populateroot.php"); $output = new OCP\Template("news", "part.addfeed"); -$output -> assign('allfeeds', $allfeeds); -$output -> printpage(); \ No newline at end of file +$output->assign('allfeeds', $allfeeds); +$output->printpage(); \ No newline at end of file diff --git a/ajax/folderdialog.php b/ajax/folderdialog.php index 97b679e66..bb1c37cf3 100644 --- a/ajax/folderdialog.php +++ b/ajax/folderdialog.php @@ -3,5 +3,5 @@ include("populateroot.php"); $output = new OCP\Template("news", "part.addfolder"); -$output -> assign('allfeeds', $allfeeds); -$output -> printpage(); \ No newline at end of file +$output->assign('allfeeds', $allfeeds); +$output->printpage(); \ No newline at end of file diff --git a/ajax/importdialog.php b/ajax/importdialog.php new file mode 100644 index 000000000..c91b5dead --- /dev/null +++ b/ajax/importdialog.php @@ -0,0 +1,4 @@ +printpage(); \ No newline at end of file diff --git a/js/settings.js b/js/settings.js index 265f12d6b..28a61dfc3 100644 --- a/js/settings.js +++ b/js/settings.js @@ -1,27 +1,46 @@ -News={ - Settings:{ +NewsSettings={ + UI: { + overview:function(dialogtype, dialogfile){ + if($(dialogtype).dialog('isOpen') == true){ + $(dialogtype).dialog('moveToTop'); + }else{ + $('#dialog_holder').load(OC.filePath('news', 'ajax', dialogfile), function(jsondata){ + if(jsondata.status != 'error'){ + $(dialogtype).dialog({ + dialogClass:'dialog', + minWidth: 600, + close: function(event, ui) { + $(this).dialog('destroy').remove(); + } + }).css('overflow','visible'); + } else { + alert(jsondata.data.message); + } + }); + } + return false; + }, cloudFileSelected:function(path){ -// $.getJSON(OC.filePath('contacts', 'ajax', 'oc_photo.php'),{'path':path,'id':Contacts.UI.Card.id},function(jsondata){ -// if(jsondata.status == 'success'){ -// //alert(jsondata.data.page); -// Contacts.UI.Card.editPhoto(jsondata.data.id, jsondata.data.tmp) -// $('#edit_photo_dialog_img').html(jsondata.data.page); -// } -// else{ -// OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); -// } -// }); - } - } +// $.getJSON(OC.filePath('contacts', 'ajax', 'oc_photo.php'),{'path':path,'id':Contacts.UI.Card.id},function(jsondata){ +// if(jsondata.status == 'success'){ +// //alert(jsondata.data.page); +// Contacts.UI.Card.editPhoto(jsondata.data.id, jsondata.data.tmp) +// $('#edit_photo_dialog_img').html(jsondata.data.page); +// } +// else{ +// OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); +// } +// }); + } + }, } $(document).ready(function(){ - + $('#opml_file').click(function() { - OC.dialogs.filepicker(t('news', 'Select file'), News.Settings.cloudFileSelected, false, '', true); + NewsSettings.UI.overview('#import_dialog', 'importdialog.php'); }); - - + //OC.dialogs.filepicker(t('news', 'Select file'), NewsSettings.cloudFileSelected, false, '', true); }); diff --git a/opmlparser.php b/opmlparser.php new file mode 100644 index 000000000..ab0c8beb0 --- /dev/null +++ b/opmlparser.php @@ -0,0 +1,15 @@ +raw = $raw; + $this->data = array(); + } + + + +} \ No newline at end of file diff --git a/templates/part.importdialog.php b/templates/part.importdialog.php new file mode 100644 index 000000000..921f21aaf --- /dev/null +++ b/templates/part.importdialog.php @@ -0,0 +1,6 @@ +
"> + + +dialog + +
\ No newline at end of file diff --git a/templates/settings.php b/templates/settings.php index bb82c9754..29cd6f42c 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -1,8 +1,12 @@
News
- - -
+
+
Import
+
+
Export
+
+
+
-- cgit v1.2.3