aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-08-27 22:01:02 -0700
committerfriendica <info@friendica.com>2014-08-27 22:01:02 -0700
commit2d210db1b85e5893afe285fc7b32f9987f1ae565 (patch)
tree5acc6288380390c8ba21543a34e60228257ec276
parenteb27bea794d5aff547be9722f7c058678b8cbb1d (diff)
downloadvolse-hubzilla-2d210db1b85e5893afe285fc7b32f9987f1ae565.tar.gz
volse-hubzilla-2d210db1b85e5893afe285fc7b32f9987f1ae565.tar.bz2
volse-hubzilla-2d210db1b85e5893afe285fc7b32f9987f1ae565.zip
ability to create/edit/delete custom profile field definitions - read the source. Currently the created entries aren't added to the allowed fields arrays, but this can be done by hand until that bit is made available. Only choice for input type at the moment is 'text' or a text input, not a textarea. Multiple choice will be added later.
-rw-r--r--doc/diaspora_compat.md2
-rw-r--r--mod/admin.php63
-rw-r--r--view/theme/redbasic/css/style.css11
-rw-r--r--view/tpl/profdef_edit.tpl16
4 files changed, 91 insertions, 1 deletions
diff --git a/doc/diaspora_compat.md b/doc/diaspora_compat.md
index 2e38dc443..29ec0a78a 100644
--- a/doc/diaspora_compat.md
+++ b/doc/diaspora_compat.md
@@ -9,7 +9,7 @@ Private mail retraction will not be possible on Diaspora.
Access control only works on posts and comments. Diaspora members will get permission denied trying to access any other access controlled redmatrix objects such as files, photos, webpages, chatrooms, etc. In the case of private photos that are linked to posts, they will see a "prohibited sign" instead of the photo. Diaspora has no concept of private media. There is no workaround except to make your media resources public (to everybody on the internet).
-Edited posts will not be delivered. Diaspora members will see the original post/comment without edits. There is no mechanism in the protocol to update an existing post. We cannot delete it and submit another invisibly because the message-id will change and we need to keep the same message-id on our own network. The only workaround is to delete the post/comment and do it over.
+Edited posts will not be delivered. Diaspora members will see the original post/comment without edits. There is no mechanism in the protocol to update an existing post. We cannot delete it and submit another invisibly because the message-id will change and we need to keep the same message-id on our own network. The only workaround is to delete the post/comment and do it over. We may eventually provide a way to delete the out of date copy only from Diaspora and keep it intact on networks that can handle edits.
Nomadic identity will not work with Diaspora. We will eventually provide an **option** which will allow you to "start sharing" from all of your clones when you make the first connection. The Diaspora person does not have to accept this, but it will allow your communications to continue if they accept this connection. Without this option, if you go to another server from where you made the connection originally or you make the connection before creating the clone, you will need to make friends with them again from the new location.
diff --git a/mod/admin.php b/mod/admin.php
index bcbb6fc26..e54163c62 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -1291,11 +1291,74 @@ readable.");
function admin_page_profs_post(&$a) {
+ if($_REQUEST['id']) {
+ $r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d limit 1",
+ dbesc($_REQUEST['field_name']),
+ dbesc($_REQUEST['field_type']),
+ dbesc($_REQUEST['field_desc']),
+ dbesc($_REQUEST['field_help']),
+ dbesc($_REQUEST['field_inputs']),
+ intval($_REQUEST['id'])
+ );
+ }
+ else {
+ $r = q("insert into profdef ( field_name, field_type, field_desc, field_help, field_inputs ) values ( '%s' , '%s', '%s', '%s', '%s' )",
+ dbesc($_REQUEST['field_name']),
+ dbesc($_REQUEST['field_type']),
+ dbesc($_REQUEST['field_desc']),
+ dbesc($_REQUEST['field_help']),
+ dbesc($_REQUEST['field_inputs'])
+ );
+ }
+
+ // add to chosen array basic or advanced
+
+ goaway(z_root() . '/admin/profs');
}
function admin_page_profs(&$a) {
+ if((argc() > 3) && argv(2) == 'drop' && intval(argv(3))) {
+ $r = q("delete from profdef where id = %d limit 1",
+ intval(argv(3))
+ );
+ // remove from allowed fields
+
+ goaway(z_root() . '/admin/profs');
+ }
+
+ if((argc() > 2) && argv(2) === 'new') {
+ return replace_macros(get_markup_template('profdef_edit.tpl'),array(
+ '$header' => t('New Profile Field'),
+ '$field_name' => array('field_name',t('Field nickname'),$_REQUEST['field_name'],t('System name of field')),
+ '$field_type' => array('field_type',t('Input type'),(($_REQUEST['field_type']) ? $_REQUEST['field_type'] : 'text'),''),
+ '$field_desc' => array('field_desc',t('Field Name'),$_REQUEST['field_desc'],t('Label on profile pages')),
+ '$field_help' => array('field_help',t('Help text'),$_REQUEST['field_help'],t('Additional info (optional)')),
+ '$submit' => t('Save')
+ ));
+
+ }
+
+ if((argc() > 2) && intval(argv(2))) {
+ $r = q("select * from profdef where id = %d limit 1",
+ intval(argv(2))
+ );
+ if(! $r) {
+ notice( t('Field definition not found') . EOL);
+ goaway(z_root() . '/admin/profs');
+ }
+
+ return replace_macros(get_markup_template('profdef_edit.tpl'),array(
+ '$id' => intval($r[0]['id']),
+ '$header' => t('New Profile Field'),
+ '$field_name' => array('field_name',t('Field nickname'),$r[0]['field_name'],t('System name of field')),
+ '$field_type' => array('field_type',t('Input type'),$r[0]['field_type'],''),
+ '$field_desc' => array('field_desc',t('Field Name'),$r[0]['field_desc'],t('Label on profile pages')),
+ '$field_help' => array('field_help',t('Help text'),$r[0]['field_help'],t('Additional info (optional)')),
+ '$submit' => t('Save')
+ ));
+ }
}
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index 209e32c52..85ab4adb8 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -371,6 +371,17 @@ aside li {
clear: both;
}
+#profile-edit-wrapper .field label {
+ margin-top: 20px;
+ width: 175px;
+}
+
+#profile-edit-wrapper .field input[type="text"] {
+ margin-top: 20px;
+ width: 220px;
+}
+
+
#profile-edit-links {
max-width: $converse_width;
padding-top: 15px;
diff --git a/view/tpl/profdef_edit.tpl b/view/tpl/profdef_edit.tpl
new file mode 100644
index 000000000..bfe85314d
--- /dev/null
+++ b/view/tpl/profdef_edit.tpl
@@ -0,0 +1,16 @@
+<h3>{{$header}}</h3>
+
+<form action="admin/profs" method="post" >
+
+{{if $id}}
+<input type="hidden" name="id" value="{{$id}}" />
+{{/if}}
+
+{{include file="field_input.tpl" field=$field_name}}
+{{include file="field_input.tpl" field=$field_type}}
+{{include file="field_input.tpl" field=$field_desc}}
+{{include file="field_input.tpl" field=$field_help}}
+
+<input name="submit" type="submit" value="{{$submit}}" />
+
+</form>