diff --git a/plugins/mobile_unl/views/mobile/form/css.php b/plugins/mobile_unl/views/mobile/form/css.php new file mode 100755 index 0000000000000000000000000000000000000000..0e646ca110377c0f526f2b08d77c3a36800ec065 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/css.php @@ -0,0 +1,19 @@ +.river_object_form_data_create { + background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_blog.gif) no-repeat left -1px; +} +.river_object_form_data_comment { + background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +} + +.form_listing .search_listing { + border:2px solid #cccccc; + margin:0 0 5px 0; +} + +#groups_info_column_left .tabberlive .tabbertab { + background-color: white; +} + +#profile_info_column_middle .tabberlive .tabbertab { + background-color: white; +} \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/default_form_data_display.php b/plugins/mobile_unl/views/mobile/form/default_form_data_display.php new file mode 100755 index 0000000000000000000000000000000000000000..c10a920092cc33c40ef5ffd9e8f180b2f2e70716 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/default_form_data_display.php @@ -0,0 +1,19 @@ +<?php + +/** + * Default form data display + * + * @package form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2009 + * @link http://radagast.biz/ + */ + +$form_data_id = $vars['entity']->getGUID(); +$data = form_get_data($form_data_id); +$form = get_entity($vars['entity']->form_id); +$tab_data = form_get_tabbed_output_display($form,$data); +echo elgg_view('form/forms/display_form_content',array('tab_data'=>$tab_data,'description'=>'','preview'=>0,'form'=>$form,'form_data_id'=>0)); +echo $vars['annotations']; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/default_form_data_listing.php b/plugins/mobile_unl/views/mobile/form/default_form_data_listing.php new file mode 100755 index 0000000000000000000000000000000000000000..29beeeb4498ec0f35b97f182fd8640c7ed174c9d --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/default_form_data_listing.php @@ -0,0 +1,25 @@ +<?php + +/** + * Default form data listing + * + * @package form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2009 + * @link http://radagast.biz/ + */ + + $owner = $vars['entity']->getOwnerEntity(); + $friendlytime = friendly_time($vars['entity']->time_created); + $icon = elgg_view( + "profile/icon", array( + 'entity' => $owner, + 'size' => 'small', + ) + ); + $info = '<p><a href="'.$vars['entity']->getURL().'">'.elgg_echo('form:submission_to').'</a> "'.get_entity($vars['entity']->form_id)->title.'"</p>'; + $info .= "<p class=\"owner_timestamp\"><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</p>"; + echo elgg_view_listing($icon,$info.$vars['annotations']); + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/display_field.php b/plugins/mobile_unl/views/mobile/form/display_field.php new file mode 100755 index 0000000000000000000000000000000000000000..8e3085ecc354907d253e44bb5d975e3ea246af63 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/display_field.php @@ -0,0 +1,26 @@ +<?php + +/** + * Elgg field display + * Displays the specified Elgg title, field and description + * + * @package Elgg + * @subpackage Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + */ + + $field = $vars['field']; + $title = $vars['title']; + $description = $vars['description']; + + $body = <<<END +<label>$title<br /> +$field +</label> +<p class="form-field-description">$description</p> +END; + print $body; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/display_object.php b/plugins/mobile_unl/views/mobile/form/display_object.php new file mode 100755 index 0000000000000000000000000000000000000000..518a0782adfdee62b9a0f674c17c83ca2d1a29f9 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/display_object.php @@ -0,0 +1,21 @@ +<?php + + /** + * Elgg display search form + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + */ + + // load form model + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php"); + +echo '<div class="contentWrapper">'; +echo form_view_entities(array($vars['form_data']), $vars['form'], 'display'); +echo '</div>'; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/display_search_object.php b/plugins/mobile_unl/views/mobile/form/display_search_object.php new file mode 100755 index 0000000000000000000000000000000000000000..91e25850fefe7d33ee9d5ca7d1eeb1a9e38bfc41 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/display_search_object.php @@ -0,0 +1,40 @@ +<?php + + /** + * Elgg display search form + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + */ + + // load form model + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php"); + +$form = get_entity($vars['form_id']); +$fd = get_entity($vars['form_data_id']); + +if (isset($_SESSION['last_search_qs'])) { + $qs = $_SERVER["QUERY_STRING"]; + // remove the form data id from the query string first + $qsi = strpos($qs,'&'); + $qs = substr($qs,$qsi+1); + + $return_to_search_results = '<p><a href="'.$CONFIG->wwwroot.'mod/form/search_results.php?'.$qs + .'">'.elgg_echo('form:return_to_search_results').'</a></p>'; +} else { + $return_to_search_results = ''; +} +echo '<div class="contentWrapper">'; +echo $return_to_search_results; + +echo form_view_entities(array($fd), $form, 'display'); + +echo $return_to_search_results; + +echo '</div>'; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/display_templates.php b/plugins/mobile_unl/views/mobile/form/display_templates.php new file mode 100755 index 0000000000000000000000000000000000000000..fb6b52614f2357148de92e6e5bf01f34ee240207 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/display_templates.php @@ -0,0 +1,18 @@ +<?php +$form = $vars['form']; +$display_bit = '<div class="tabbertab" title="'.elgg_echo('form:display_templates_tab_label').'">'; + +$display_bit .= '<label for="list_template">'.elgg_echo('form:list_template_label'); +$display_bit .= elgg_view('input/longtext',array('internalname'=>'list_template','value'=>$form->list_template)); +$display_bit .= '</label>'; +$display_bit .= '<p class="description">'.elgg_echo('form:list_template_description').'</p>'; + +$display_bit .= '<label for="display_template">'.elgg_echo('form:display_template_label'); +$display_bit .= elgg_view('input/longtext',array('internalname'=>'display_template','value'=>$form->display_template)); +$display_bit .= '</label>'; +$display_bit .= '<p class="description">'.elgg_echo('form:display_template_description').'</p>'; +$display_bit .= '<input type="submit" name="submit" value="'.elgg_echo('form:form_manage_button').'">'; +$display_bit .= '</div>'; + +echo $display_bit; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/entity_list.php b/plugins/mobile_unl/views/mobile/form/entity_list.php new file mode 100755 index 0000000000000000000000000000000000000000..69cef29aff832869a1eda2fb1ebbb2d205522904 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/entity_list.php @@ -0,0 +1,61 @@ +<?php + +// load form model +require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php"); + +$context = $vars['context']; +$offset = $vars['offset']; +$entities = $vars['entities']; +$form = $vars['form']; +$limit = $vars['limit']; +$count = $vars['count']; +$baseurl = $vars['baseurl']; +$context = $vars['context']; +$viewtype = $vars['viewtype']; + +$html = ""; +$nav = ""; + +if (isset($vars['viewtypetoggle'])) { + $viewtypetoggle = $vars['viewtypetoggle']; +} else { + $viewtypetoggle = true; +} + +if ($context == "search" && $count > 0 && $viewtypetoggle) { + $nav .= elgg_view("navigation/viewtype",array( + + 'baseurl' => $baseurl, + 'offset' => $offset, + 'count' => $count, + 'viewtype' => $viewtype, + + )); +} + +$nav .= elgg_view('navigation/pagination',array( + + 'baseurl' => $baseurl, + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, + +)); + +$html .= $nav; + +if ($fullview) { + $viewtype = 'display'; +} + +if (is_array($entities) && sizeof($entities) > 0) { + + $html .= form_view_entities($entities, $form, $viewtype); +} + +if ($count) +$html .= $nav; + +echo $html; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/extended_display_field.php b/plugins/mobile_unl/views/mobile/form/extended_display_field.php new file mode 100755 index 0000000000000000000000000000000000000000..14b7a8b182292d83029b24194277b5bc3d69e192 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/extended_display_field.php @@ -0,0 +1,22 @@ +<?php + +/** + * Form extended field display + * + * @package form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + */ + + $value = $vars['value']; + $title = $vars['title']; + + $body = <<<END +<label>$title<br /> +<p>$value</p> +</label> +END; + print $body; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/field_list.php b/plugins/mobile_unl/views/mobile/form/field_list.php new file mode 100755 index 0000000000000000000000000000000000000000..0198aa4f0d5502ac82724b94b3bfef44d2cc68d4 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/field_list.php @@ -0,0 +1,55 @@ +<?php +$form_id = $vars['form_id']; +$profile = $vars['profile']; + +$edit_msg = elgg_echo('form:edit'); +$remove_msg = elgg_echo('form:remove'); +$remove_confirm_msg = elgg_echo('form:remove_confirm'); +$moveup_msg = elgg_echo('form:move_up'); +$movedown_msg = elgg_echo('form:move_down'); +$movetop_msg = elgg_echo('form:move_top'); +$movebottom_msg = elgg_echo('form:move_bottom'); + +$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$vars['config']->wwwroot.'mod/form/images/%s" />'; +$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png"); +$remove_img = sprintf($img_template,$remove_msg,$remove_msg,"16-em-cross.png"); +$moveup_img = sprintf($img_template,$moveup_msg,$moveup_msg,"16-em-open.png"); +$movedown_img = sprintf($img_template,$movedown_msg,$movedown_msg,"16-em-down.png"); +$movetop_img = sprintf($img_template,$movetop_msg,$movetop_msg,"16-em-left.png"); +$movebottom_img = sprintf($img_template,$movebottom_msg,$movebottom_msg,"16-em-right.png"); + +$start_url = $vars['config']->wwwroot.'action/form/manage_field?form_action=move&id=%s&form_id=%s&direction='; +$link_template = '<a onclick="javascript:$(\'#field_list\').load(\'%s%s\'); return false;" href="%s%s">%s</a>'; + +$field_template = <<<END +<a href="{$vars['config']->wwwroot}action/form/manage_field?form_action=edit&id=%s&form_id=%s&profile=$profile">$edit_img</a> | +<a onclick="return confirm('$remove_confirm_msg')" href="{$CONFIG->wwwroot}action/form/manage_field?form_action=remove&id=%s&form_id=%s">$remove_img</a> | +%s | +%s | +%s | +%s +%s +<br /> +END; + +$fields = $vars['fields']; + +if ($fields && count($fields) > 0 ) { + foreach ($fields AS $field) { + $ident = $field->getGUID(); + $url = sprintf($start_url,$ident,$form_id); + $up = sprintf($link_template,$url,'up',$url,'up',$moveup_img); + $down = sprintf($link_template,$url,'down',$url,'down',$movedown_img); + $top = sprintf($link_template,$url,'top',$url,'top',$movetop_img); + $bottom = sprintf($link_template,$url,'bottom',$url,'bottom',$movebottom_img); + $field_list .= sprintf( $field_template,$ident,$form_id,$ident,$form_id, + $up,$down,$top,$bottom, + $field->title . ' ('.$field->internal_name.': '.$field->field_type.')'); + } + $field_list .= '<br />'; +} else { + $field_list .= '<p>'.elgg_echo('form:none').'.</p>'; +} + +echo $field_list; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/form_data_admin.php b/plugins/mobile_unl/views/mobile/form/form_data_admin.php new file mode 100755 index 0000000000000000000000000000000000000000..19a6e536bd33b6459350693186ce59ca61fab831 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/form_data_admin.php @@ -0,0 +1,13 @@ +<?php +$manage_bit = '<div class="form-manage">'; +$manage_bit .= '<a href="'.$vars['url'].'mod/form/form.php?id='.$vars['form_id'].'&d='.$vars['form_data_id'].'">'; +$manage_bit .= elgg_echo('form:edit'); +$manage_bit .= '</a> | '; +$manage_bit .= '<a onclick="return confirm(\''.elgg_echo('form:content_delete_confirm').'\')" '; +$manage_bit .= 'href="'.$vars['url'].'action/form/manage_form_data?form_action=delete&d='.$vars['form_data_id'].'">'; +$manage_bit .= elgg_echo('form:delete'); +$manage_bit .= '</a>'; +$manage_bit .= '</div><br />'; + +echo $manage_bit; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/display_form.php b/plugins/mobile_unl/views/mobile/form/forms/display_form.php new file mode 100755 index 0000000000000000000000000000000000000000..c8eb0cccc450d812456a91728ccede3d8fc044a5 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/display_form.php @@ -0,0 +1,69 @@ +<?php + +/** + * Elgg field display + * Displays the specified Elgg title, field and description + * + * @package Elgg + * @subpackage Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + */ + + $tab_data = $vars['tab_data']; + $form = $vars['form']; + $preview = $vars['preview']; + $form_data_id = $vars['form_data_id']; + + if (isset($vars['description'])) { + $description = $vars['description']; + } else { + $description = form_form_t($form,'description'); + } + + if ($preview) { + $body = '<div class="contentWrapper">'.elgg_echo('form:preview_description').'</div>'; + } else { + $body = ''; + } + // TODO - add some intelligent way to determine the form enctype? + $body .= <<<END +<script type="text/javascript" src="{$vars['url']}mod/form/tabber/tabber.js"></script> +<link rel="stylesheet" href="{$vars['url']}mod/form/tabber/example.css" type="text/css" media="screen" /> +<div class="contentWrapper"> +$description +</div> +<div class="contentWrapper"> +<form action="{$vars['url']}action/form/submit" method="post" enctype="multipart/form-data"> +END; + $body .= elgg_view('input/hidden',array('internalname'=>'form_id', 'value'=>$form->getGUID())); + $body .= elgg_view('input/hidden',array('internalname'=>'preview', 'value'=>$preview)); + $body .= elgg_view('input/hidden',array('internalname'=>'form_data_id', 'value'=>$form_data_id)); + + $count = count($tab_data); + + if ($count > 1) { + $body .= '<div class="tabber">'; + $body .= '<div class="tabberloading" ></div>'; + foreach($tab_data as $tab => $html) { + if ($html) { + $body .= "<div class=\"tabbertab\" title=\"$tab\">"; + $body .= $html; + $body .= "</div>\n"; + } + + } + $body .= '</div>'; + } else if ($count == 1) { + // don't show tabs if there is only one + foreach($tab_data as $tab => $html) { + $body .= $html; + } + } + + $body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('form:submit'))); + $body .= '</form></div>'; + print $body; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/display_form_content.php b/plugins/mobile_unl/views/mobile/form/forms/display_form_content.php index 077c62f642746dc4f603344da900cf68badb5d65..1960df387b4a4a81c93fd87b4d81d9f5647b701d 100644 --- a/plugins/mobile_unl/views/mobile/form/forms/display_form_content.php +++ b/plugins/mobile_unl/views/mobile/form/forms/display_form_content.php @@ -33,10 +33,7 @@ $body .= elgg_view('input/hidden',array('internalname'=>'preview', 'value'=>$pre $body .= elgg_view('input/hidden',array('internalname'=>'form_data_id', 'value'=>$form_data_id)); $body .= "<p class=\"form-description\">$description</p>"; - - if (count($tab_data) > 1) { - $body .= <<<END <script type="text/javascript" src="{$CONFIG->wwwroot}mod/form/tabber/tabber.js"></script> <link rel="stylesheet" href="{$CONFIG->wwwroot}mod/form/tabber/example.css" type="text/css" media="screen" /> @@ -57,5 +54,4 @@ END; } } echo $body; - ?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/field_adders.php b/plugins/mobile_unl/views/mobile/form/forms/field_adders.php new file mode 100755 index 0000000000000000000000000000000000000000..7774a73f72be0fa64f400c82109f8d8daceb8ba2 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/field_adders.php @@ -0,0 +1,85 @@ +<?php +/* buttons and links: + * + * preview form (link) + * add existing field (input box for field name) + * copy existing field (copies field definition) (input boxes for field name) + * add new field (input box for field name) + */ + +$form_id = $vars['form_id']; +$profile = $vars['profile']; + +//TODO: clean this up + +$add_existing_button = elgg_echo('form:add_existing_button'); +$add_existing_field_description = elgg_echo('form:add_existing_field_description'); +$copy_existing_button = elgg_echo('form:copy_existing_button'); +$copy_existing_field_description = elgg_echo('form:copy_existing_field_description'); +$add_new_button = elgg_echo('form:add_new_button'); +$add_new_description = elgg_echo('form:add_new_description'); +$existing_label = elgg_echo('form:existing_label'); +$new_label = elgg_echo('form:new_label'); + +$add_fields_title = elgg_echo('form:add_fields_title'); +$add_existing_title = elgg_echo('form:add_existing_title'); +$copy_existing_title = elgg_echo('form:copy_existing_title'); +$add_new_title = elgg_echo('form:add_new_title'); + +$field_adders_tab = elgg_echo('form:field_adders_tab_label'); + +$buttons = <<<END +<div class="tabbertab" title="$field_adders_tab"> +<form action="{$vars['url']}action/form/manage_field" method="post"> +<input type="hidden" name="form_id" value="$form_id"> +<input type="hidden" name="form_action" value="add_new"> +<input type="hidden" name="profile" value="$profile"> +<label class="labelclass" for="new_field_name">$new_label</label> +END; + +$buttons .= elgg_view('input/text',array('internalname'=>'new_field_name')); + +$buttons .= <<<END +<br /> +<span class="description">$add_new_description<br /> +<input type="submit" name="submit" value="$add_new_button"></span> +</form> +<br /> +<form action="{$vars['url']}action/form/manage_field" method="post"> +<input type="hidden" name="form_id" value="$form_id"> +<input type="hidden" name="form_action" value="add_existing"> +<input type="hidden" name="profile" value="$profile"> +<label class="labelclass" for="existing_field_name">$existing_label</label> +END; + +$buttons .= elgg_view('input/text',array('internalname'=>'existing_field_name')); + +$buttons .= <<<END +<br /> +<span class="description">$add_existing_field_description<br /> +<input type="submit" name="submit" value="$add_existing_button"></span> +</form> +<form action="{$vars['url']}action/form/manage_field" method="post"> +<input type="hidden" name="form_id" value="$form_id"> +<input type="hidden" name="form_action" value="copy_existing"> +<input type="hidden" name="profile" value="$profile"> +<label class="labelclass" for="existing_field_name">$existing_label</label> +END; + +$buttons .= elgg_view('input/text',array('internalname'=>'existing_field_name')); + +$buttons .= <<<END +<label class="labelclass" for="new_field_name">$new_label</label> +END; + +$buttons .= elgg_view('input/text',array('internalname'=>'new_field_name')); + +$buttons .= <<<END +<p class="description">$copy_existing_field_description<br /> +<input type="submit" name="submit" value="$copy_existing_button"></p> +</form> +</div> +END; + +echo $buttons; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/list_fields.php b/plugins/mobile_unl/views/mobile/form/forms/list_fields.php new file mode 100755 index 0000000000000000000000000000000000000000..10cb297c97a05070f55c43d145f3aaa8db54a8cf --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/list_fields.php @@ -0,0 +1,64 @@ +<?php + + /** + * Elgg list fields view + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['form'] Optionally, the form to edit + */ + +$type = $vars['page_return_type']; +$fields = $vars['fields']; +$username = $vars['user']->username; + +$edit_msg = elgg_echo('form:edit');; +$delete_msg = elgg_echo('form:delete'); +$delete_orphans_confirm_msg = elgg_echo('form:orphan_delete_all_confirm'); +if ($type == 'orphan') { + $delete_confirm_msg = elgg_echo('form:orphan_delete_confirm'); +} else { + $delete_confirm_msg = elgg_echo('form:field_delete_confirm'); +} + +$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$CONFIG->wwwroot.'mod/form/images/%s" />'; +$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png"); +$delete_img = sprintf($img_template,$delete_msg,$delete_msg,"16-em-cross.png"); + +$field_template = <<<END +<a href="{$CONFIG->wwwroot}action/form/manage_field?form_action=edit_with_field_id&id=%s&type=%s&username=$username">$edit_img</a> | +<a onclick="return confirm('$delete_confirm_msg')" href="{$CONFIG->wwwroot}action/form/manage_field?form_action=delete&id=%s&type=%s&username=$username">$delete_img</a> + %s +<br /> +END; + +$body .= '<div class="contentWrapper">'; +if ($type == 'orphan') { + $body .= '<p><b><a onclick="return confirm(\''.$delete_orphans_confirm_msg.'\')" href="'.$CONFIG->wwwroot.'action/form/manage_fields?form_action=delete_orphans&username='.$username.'">'.elgg_echo('form:delete_orphans').'</a></b></p> '."\n"; + $body .= '<p>'.elgg_echo('form:orphan_list_description').'</p>'."\n"; +} else { + $body .= '<p>'.elgg_echo('form:field_list_description').'</p>'."\n"; +} + +if ($fields) { + foreach ($fields as $field) { + $field_id = $field->getGUID(); + $body .= sprintf( + $field_template, + $field_id, + $type, + $field_id, + $type, + $field->title . ' ('.$field->internal_name.': '.$field->field_type.')'); + } +} else { + $body .= '<p>'.elgg_echo('form:no_fields').'</p>'; +} +$body .= '</div>'; +print $body; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/list_forms.php b/plugins/mobile_unl/views/mobile/form/forms/list_forms.php new file mode 100755 index 0000000000000000000000000000000000000000..39a13da665fd2a9d4eb60ebabf2afebd24c15960 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/list_forms.php @@ -0,0 +1,79 @@ +<?php +/* + * Elgg Forms + * Kevin Jardine + * Radagast Solutions + * http://radagast.biz + * + * Displays existing forms + * + */ + + // load form model + require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/models/model.php"); + +//$title = elgg_echo('form:list_forms_title'); + +$view_all_text = elgg_echo('form:view_all'); + +$form_template = <<<END +<div class="contentWrapper"> +<h2>%s</h2> +<p> +%s +</p> +%s +<a href="{$CONFIG->wwwroot}mod/form/my_forms.php?id=%s&form_view=all">$view_all_text</a> +%s +</div> +END; + +//$pg_owner_entity = page_owner_entity(); +//$username = $pg_owner_entity->username; + +$body = ''; + +$profile_form = form_get_latest_public_profile_form(); + +if ($profile_form) { + $sd_list = get_entities_from_metadata('form_id',$profile_form->getGUID(),'object','form:search_definition'); + if ($sd_list) { + $body .= '<div class="contentWrapper">'; + $body .= '<h2>'.elgg_echo('form:profiles').'</h2><br />'; + foreach($sd_list as $sd) { + $sd_id = $sd->getGUID(); + $body .= "<a href=\"{$vars['url']}mod/form/search.php?sid=$sd_id\">".form_search_definition_t($form,$sd,'title')."</a><br />"; + } + $body .= '</div>'; + } +} + +$forms = get_entities_from_metadata('profile','0','object','form:form'); +if ($forms) { + foreach ($forms as $form) { + $form_id = $form->getGUID(); + if (isloggedin()) { + $add_bit = '<a href="'.$vars['url'].'mod/form/form.php?id='.$form_id.'">'.elgg_echo('form:add_content').'</a> | '; + } else { + $add_bit = ''; + } + $sd_bit = ''; + $sd_list = get_entities_from_metadata('form_id',$form_id,'object','form:search_definition'); + if ($sd_list) { + foreach($sd_list as $sd) { + $sd_id = $sd->getGUID(); + $sd_bit .= "| <a href=\"{$vars['url']}mod/form/search.php?sid=$sd_id\">".form_search_definition_t($form,$sd,'title')."</a>"; + } + } + $body .= sprintf($form_template,form_form_t($form,'title'),form_form_t($form,'listing_description'),$add_bit,$form_id,$sd_bit); + } +} else { + if (!$profile_form) { + $body .= '<p>'.elgg_echo('form:no_content').'</p>'; + } +} + +print $body; + + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/list_search_definitions.php b/plugins/mobile_unl/views/mobile/form/forms/list_search_definitions.php new file mode 100755 index 0000000000000000000000000000000000000000..5e79cf40c3c06cf5a4a31d522e5b463f75495883 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/list_search_definitions.php @@ -0,0 +1,45 @@ +<?php +/* + * Elgg Forms + * Kevin Jardine + * Radagast Solutions + * http://radagast.biz + * + * Displays existing search definitions + * + */ + +$edit_msg = elgg_echo('form:edit'); +$delete_msg = elgg_echo('form:delete'); +$delete_confirm_msg = elgg_echo('form:search_definition_delete_confirm'); +$search_page = elgg_echo('form:search_page_link'); + +$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$CONFIG->wwwroot.'mod/form/images/%s" />'; +$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png"); +$delete_img = sprintf($img_template,$delete_msg,$delete_msg,"16-em-cross.png"); + +$sd_template = <<<END +<a href="{$CONFIG->wwwroot}mod/form/manage_search_definition.php?sid=%s">$edit_img</a> | +<a onclick="return confirm('$delete_confirm_msg')" href="{$CONFIG->wwwroot}action/form/manage_search_definition?form_action=delete&sid=%s">$delete_img</a> | +<a href="{$CONFIG->wwwroot}mod/form/search.php?sid=%s">$search_page</a> %s (%s) +<br /> +END; + +$body = '<div class="contentWrapper">'; + +$form_id = get_input('form_id',0); +$sds = get_entities_from_metadata('form_id',$form_id,'object','form:search_definition'); +if ($sds) { + foreach ($sds as $sd) { + $ident = $sd->getGUID(); + $body .= sprintf($sd_template,$ident,$ident,$ident,$sd->title,$sd->internalname); + } +} else { + $body .= '<p>'.elgg_echo('form:no_search_definitions').'</p>'; +} + +$body .= '</div>'; + +print $body; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/manage_all_forms.php b/plugins/mobile_unl/views/mobile/form/forms/manage_all_forms.php new file mode 100755 index 0000000000000000000000000000000000000000..6231a512ae19e34a66a9205977653854f4837f9b --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/manage_all_forms.php @@ -0,0 +1,67 @@ +<?php +/* + * Elgg Forms + * Kevin Jardine + * Radagast Solutions + * http://radagast.biz + * + * Displays existing forms + * + */ + +$title = elgg_echo('form:list_forms_title'); + +$edit_msg = elgg_echo('form:edit'); +$delete_msg = elgg_echo('form:delete'); +$delete_confirm_msg = elgg_echo('form:form_delete_confirm'); + +$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$CONFIG->wwwroot.'mod/form/images/%s" />'; +$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png"); +$delete_img = sprintf($img_template,$delete_msg,$delete_msg,"16-em-cross.png"); +$export_text = elgg_echo('form:export'); +$preview_text = elgg_echo('form:preview'); +$link_text = elgg_echo('form:link'); + +$form_template = <<<END +<a href="{$CONFIG->wwwroot}mod/form/manage_form.php?id=%s">$edit_img</a> | +<a onclick="return confirm('$delete_confirm_msg')" href="{$CONFIG->wwwroot}action/form/manage_form?form_action=delete&id=%s">$delete_img</a> | +<a href="{$CONFIG->wwwroot}mod/form/form.php?id=%s&preview=true">$preview_text</a> | +<a href="{$CONFIG->wwwroot}mod/form/form.php?id=%s">$link_text</a> + %s +<br /> +END; + +$body = '<div class="contentWrapper">'; + +/*$user_content_status = form_get_user_content_status(); +$body .= '<h2>'.elgg_echo('form:user_content_status_title').'</h2><br />'; + +$options = array( 1=>elgg_echo('form:yes'), +0=>elgg_echo('form:no') ); + +$body .= '<form action="'.$CONFIG->wwwroot.'action/form/manage_form" method ="post" >'; +$body .= elgg_view('input/hidden',array('internalname'=>'form_action', 'value'=>'user_content_status')); + +$body .= elgg_view('form/input/radio',array('internalname'=>'user_content_status','options'=>$options,'value'=>$user_content_status)); + +$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('form:submit'))); +$body .= '</form>';*/ + +$body .= '<h2>'.elgg_echo('form:form_list').'</h2><br />'; + +$forms = get_entities('object','form:form'); +if ($forms) { + foreach ($forms as $form) { + $ident = $form->getGUID(); + $body .= sprintf($form_template,$ident,$ident,$ident,$ident,$form->title.' ('.$form->name.')'); + } +} else { + $body .= '<p>'.elgg_echo('form:no_forms').'</p>'; +} + +$body .= '</div>'; + +echo $body; + + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/manage_field.php b/plugins/mobile_unl/views/mobile/form/forms/manage_field.php new file mode 100755 index 0000000000000000000000000000000000000000..ed7522c82b6289dd2c50d7d908af11c52b7dc17e --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/manage_field.php @@ -0,0 +1,696 @@ +<?php + +/** + * Elgg manage field page + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['field'] The field to edit + * $vars['form_id'] The form to add a new field to + * $vars['new_field_name'] Optionally, an internal name for this field + */ + +$form_field_types = form_get_form_field_types(); + +$i = 0; + +foreach ($form_field_types as $type => $ft) { + if ($type == 'contact') { + $contact_index = $i; + } else if ($type == 'choices') { + $choices_index = $i; + } + $i += 1; +} + +$form_id = $vars['form_id']; +$field = $vars['field']; +$choices = $vars['choices']; +$page_return_type = $vars['page_return_type']; +$new_field_name = $vars['new_field_name']; +$username = $vars['username']; + +$profile_label = elgg_echo('form:profile_label'); +$profile_description = elgg_echo('form:profile_description'); +$yes = elgg_echo('form:yes'); +$no = elgg_echo('form:no'); + +$profile_bit = <<<END +<label class="labelclass" for="profile">$profile_label</label> +<input type="radio" name="profile" value="0" onChange="vis();" %s> $no +<input type="radio" name="profile" value="1" onChange="vis();" %s> $yes +<p class="description">$profile_description</p> +END; + +if (!isset($vars['profile'])) { + if ($form_id) { + $profile = get_entity($form_id)->profile; + } else { + $profile = 0; + } +} else { + $profile = $vars['profile']; +} + +if (!$profile) { + $profile = 0; +} + +// set up the field values + +if ($field) { + if ($new_field_name) { + // this is duplicating an existing field + $form_action = 'add'; + $field_id = 0; + $internal_name = $new_field_name; + } else { + $form_action = 'change'; + $field_id = $field->getGUID(); + $internal_name = $field->internal_name; + } + + $form_title = $field->title; + $description = $field->description; + $field_type = $field->field_type; + + // must do this because Elgg has trouble with metadata set to "0" + // in Elgg 1.5 + $m = get_metadata_byname($field->getGUID(),'default_access'); + if ($m) { + $default_access = $m->value; + if ($default_access !== '') { + $field_access = (int) $default_access; + } else { + $field_access = ''; + } + } else { + $field_access = ''; + } + $default_value = $field->default_value; + $is_keyword_tag = $field->is_keyword_tag; + if (in_array($field_type,array('url','email','aim','msn','skype','icq'))) { + $contact_type = $field_type; + $field_type = 'contact'; + $contact_class = 'visible'; + } else { + $contact_class = 'invisible'; + $contact_type = ''; + } + + if (isset($choices)) { + $number_of_options = count($choices); + } else { + $number_of_options = 0; + } + + if ($field_type == 'choices') { + $choices_class = 'visible'; + if (($profile == 1) | ($profile == 2)) { + $is_keyword_tag_class = 'visible'; + } else { + $is_keyword_tag_class = 'invisible'; + } + + } else { + $choices_class = 'invisible'; + $is_keyword_tag_class = 'invisible'; + } + + $required_no_checked = ''; + $required_yes_checked = ''; + if ($field->required) { + $required_yes_checked = 'checked'; + } else { + $required_no_checked = 'checked'; + } + + $admin_only_no_checked = ''; + $admin_only_yes_checked = ''; + if ($field->admin_only) { + $admin_only_yes_checked = 'checked'; + } else { + $admin_only_no_checked = 'checked'; + } + + $profile_no_checked = ''; + $profile_yes_checked = ''; + + if (($profile == 1) || ($profile==2)) { + $profile_yes_checked = 'checked'; + $profile_class = 'visible'; + } else { + $profile_no_checked = 'checked'; + $profile_class = 'invisible'; + } + + // remove this for now + + /*if ($profile_bit) { + $profile_bit = sprintf($profile_bit, $profile_no_checked, $profile_yes_checked); + }*/ + $profile_bit = ''; + + $category = $field->tab; + $subtype_filter = $field->subtype_filter; + + $invisible_no_checked = ''; + $invisible_yes_checked = ''; + if ($field->invisible) { + $invisible_yes_checked = 'checked'; + } else { + $invisible_no_checked = 'checked'; + } + + $is_keyword_tag_no_checked = ''; + $is_keyword_tag_yes_checked = ''; + if ($is_keyword_tag) { + $is_keyword_tag_yes_checked = 'checked'; + } else { + $is_keyword_tag_no_checked = 'checked'; + } + + // make this always invisible as it is not currently used + $is_keyword_tag_class = 'invisible'; + + $area_left_checked = ''; + $area_right_checked = ''; + $area_bottom_checked = ''; + $area_no_checked = ''; + if ($field->area == 'left') { + $area_left_checked = 'checked'; + } else if ($field->area == 'right') { + $area_right_checked = 'checked'; + } else if ($field->area == 'bottom') { + $area_bottom_checked = 'checked'; + } else { + $area_no_checked = 'checked'; + } + + $choice_type_select_checked = ''; + $choice_type_radio_checked = ''; + $choice_type_checkbox_checked = ''; + if ($field->choice_type == 'pulldown') { + $choice_type_select_checked = 'checked'; + $orientation_class = 'invisible'; + } else if ($field->choice_type == 'radio') { + $choice_type_radio_checked = 'checked'; + $orientation_class = 'visible'; + } else { + $choice_type_checkbox_checked = 'checked'; + $orientation_class = 'visible'; + } + + $orientation_horizontal_checked = ''; + $orientation_vertical_checked = ''; + if ($field->orientation == 'horizontal') { + $orientation_horizontal_checked = 'checked'; + } else { + $orientation_vertical_checked = 'checked'; + } + +} else { + $form_action = 'add'; + + $number_of_options = 0; + //$profile = $vars['profile']; + + $orientation_class = 'invisible'; + $profile_class = 'invisible'; + $choices_class = 'invisible'; + $contact_class = 'invisible'; + $is_keyword_tag_class = 'invisible'; + + $field_id = 0; + + $internal_name = $new_field_name; + $form_title = ''; + $description = ''; + $field_type = 'profile_shorttext'; + $field_access = ''; + $contact_type = 'web'; + + $default_value = ''; + $is_keyword_tag_no_checked = 'checked'; + $is_keyword_tag_yes_checked = ''; + // make this always invisible as it is not currently used + $is_keyword_tag_class = 'invisible'; + + $required_no_checked = 'checked'; + $required_yes_checked = ''; + + $admin_only_no_checked = 'checked'; + $admin_only_yes_checked = ''; + + $profile_no_checked = ''; + $profile_yes_checked = ''; + if (($profile == 1) || ($profile == 2)) { + $profile_yes_checked = 'checked'; + $profile_class = 'visible'; + $profile_bit = '<input type="hidden" name="profile" value="'.$profile.'1">'; + } else { + $profile_no_checked = 'checked'; + $profile_class = 'invisible'; + // for now lock this in + // will have a toggle when I introduce mixed forms + //$profile_bit = sprintf($profile_bit, $profile_no_checked, $profile_yes_checked); + $profile_bit = '<input type="hidden" name="profile" value="'.$profile.'">'; + } + + $category = ''; + $subtype_filter = ''; + + $invisible_no_checked = 'checked'; + $invisible_yes_checked = ''; + + $registration_no_checked = 'checked'; + $registration_yes_checked = ''; + + $area_right_checked = 'checked'; + $area_left_checked = ''; + $area_bottom_checked = ''; + $area_no_checked = ''; + + $choice_type_select_checked = 'checked'; + $choice_type_radio_checked = ''; + $choice_type_checkbox_checked = ''; + + $orientation_horizontal_checked = 'checked'; + $orientation_vertical_checked = ''; +} + +// define the Javascript and CSS + +$body = <<<END +<script> +number_of_options = $number_of_options; + +function vis() { + var x,v; + // show profile config if relevant + v = document.field_form.profile; + x = document.getElementById('profile_config'); + /*if (v && v[1] && v[1].checked) { + x.className = 'visible'; + } else { + x.className = 'invisible'; + }*/ + + // hack to make this always visible for now + profile = $profile; + if ((profile == 1) || (profile == 2)) { + x.className = 'visible'; + } else { + x.className = 'invisible'; + } + + // show choice config if relevant + //u = document.field_form.profile; + v = document.field_form.field_type; + x = document.getElementById('choices_config'); + y = document.getElementById('contact_config'); + z = document.getElementById('is_keyword_tag_config'); + z.className = 'invisible'; + if (v.options[$choices_index].selected) { + x.className = 'visible'; + y.className = 'invisible'; + //if (u[1].checked) { + // z.className = 'visible'; + //} + } else if (v.options[$contact_index].selected) { + x.className = 'invisible'; + y.className = 'visible'; + } else { + x.className = 'invisible'; + y.className = 'invisible'; + } + + // show orientation config if relevant + v = document.field_form.choice_type; + x = document.getElementById('orientation_config'); + if (v[1].checked || v[2].checked) { + x.className = 'visible'; + } else { + x.className = 'invisible'; + } +} + +function add_option() { + var o,el; + o = document.getElementById('option_container'); + el = document.createElement('input'); + el.type = 'text'; + el.className = "option_value_input"; + el.name = "option_"+number_of_options+"_value"; + el.value = ""; + o.appendChild(el); + el = document.createElement('input'); + el.type = 'text'; + el.className = "option_label_input"; + el.name = "option_"+number_of_options+"_label"; + el.value = ""; + o.appendChild(el); + el = document.createElement('br'); + o.appendChild(el); + number_of_options++; + document.field_form.number_of_options.value = number_of_options; + + x = document.getElementById('option_outer_container'); + x.className = 'visible'; +} +</script> +<style> +div.invisible { + display: none; +} +div.visibleright { + float:right; + width: 100px; +} + +label.labelclass { + display:block; + font-weight:bold; +} + +p.description { + font-size: 0.9em; + margin-top: 0px; +} + +span.option_value_header { + font-weight: bold; + width: 150px; + display: block; + float: left; +} + +span.option_label_header { + font-weight: bold; + width: 300px; + margin-left: 10px; +} + +input.option_value_input { + width:150px; +} + +input.option_label_input { + margin-left:10px; + width:300px; +} + +input.standard { + width: 100%; +} + +input.longer { + width:100%; +} +</style> +END; + +print $body; + +// define a whole lot of text + +$horizontal = elgg_echo('form:horizontal'); +$vertical = elgg_echo('form:vertical'); + +if ($form_action == 'add') { + $title = elgg_echo('form:add_field_title'); + $form_description = elgg_echo('form:add_field_description'); +} else { + $title = elgg_echo('form:manage_field_title'); + $form_description = elgg_echo('form:manage_field_description'); +} + +$internal_name_label = elgg_echo('form:internal_name_label'); +$internal_name_description = elgg_echo('form:internal_name_description'); + +$title_label = elgg_echo('form:title_label'); +$title_description = elgg_echo('form:title_description'); + +$description_label = elgg_echo('form:description_label'); +$description_description = elgg_echo('form:description_description'); + +$required_label = elgg_echo('form:required_label'); +$required_description = elgg_echo('form:required_description'); + +$admin_only_label = elgg_echo('form:admin_only_label'); +$admin_only_description = elgg_echo('form:admin_only_description'); + +$field_type_label = elgg_echo('form:field_type_label'); + +$profile_config_title = elgg_echo('form:profile_config_title'); + +$category_label = elgg_echo('form:category_label'); +$category_description = elgg_echo('form:category_description'); + +$subtype_label = elgg_echo('form:subtype_label'); +$subtype_description = elgg_echo('form:subtype_description'); + +$invisible_label = elgg_echo('form:invisible_label'); + +$invisible_description = elgg_echo('form:invisible_description'); + +$registration_label = elgg_echo('form:registration_label'); + +$registration_description = elgg_echo('form:registration_description'); + +$column_label = elgg_echo('form:column_label'); + +$column_description = elgg_echo('form:column_description'); + +$choice_header = elgg_echo('form:choice_header'); + +$choice_field_type_label = elgg_echo('form:choice_field_type_label'); +$choice_field_type_description = elgg_echo('form:choice_field_type_description'); + +$dropdown = elgg_echo('form:dropdown'); +$radio = elgg_echo('form:radio'); +$checkbox = elgg_echo('form:checkbox'); + +$default_value_label = elgg_echo('form:default_value_label'); +$default_value_description = elgg_echo('form:default_value_description'); + +$is_keyword_tag_label = elgg_echo('form:is_keyword_tag_label'); +$is_keyword_tag_description = elgg_echo('form:is_keyword_tag_description'); + +$orientation_label = elgg_echo('form:orientation_label'); +$orientation_description = elgg_echo('form:orientation_description'); + +$access_label = elgg_echo('form:access_label'); +$access_description = elgg_echo('form:access_description'); + +$options_header = elgg_echo('form:options_header'); +$options_value_header = elgg_echo('form:options_value_header'); +$options_label_header = elgg_echo('form:options_label_header'); +$options_description = elgg_echo('form:options_description'); +$options_add_button = elgg_echo('form:options_add_button'); + +$profile_left = elgg_echo('form:profile_left'); +$profile_right = elgg_echo('form:profile_right'); +$profile_bottom = elgg_echo('form:profile_bottom'); + +// set up some form components + +if ($form_action == "add") { + $manage_field_button = elgg_echo('form:add_field_button'); +} else { + $manage_field_button = elgg_echo('form:change_field_button'); +} + +$this_form_link_text = elgg_echo('form:this_form_link_text'); +$form_link_text = elgg_echo('form:form_link_text'); +$field_link_text = elgg_echo('form:field_link_text'); + +// TODO: the following code shows the admin's access list. +// Try to find something more generic. + +$access_options = get_write_access_array(); +$access_options[''] = elgg_echo('form:use_system_default_access'); + +/*$access_options = array( + '' => elgg_echo('form:use_system_default_access'), + 'PRIVATE' => elgg_echo('ACCESS_PRIVATE'), + 'PUBLIC' => elgg_echo('ACCESS_PUBLIC'), + 'LOGGED_IN' => elgg_echo('ACCESS_LOGGED_IN'), +);*/ + +$access = '<select name="default_access">'."\n"; +foreach ($access_options AS $value => $label) { + if ($value === $field_access) { + $selected = 'selected'; + } else { + $selected = ''; + } + $access .= sprintf('<option value="%s" %s>%s</option>'."\n", $value, $selected, $label); +} + +$access .= '</select>'."\n"; + +$field_type_select = '<select name="field_type" onChange="vis();">'."\n"; + +foreach ($form_field_types AS $value => $ft) { + if ($value == $field_type) { + $selected = 'selected'; + } else { + $selected = ''; + } + $field_type_select .= sprintf('<option value="%s" %s>%s</option>'."\n", $value, $selected, $ft->label); +} + +$field_type_select .= '</select>'."\n"; + +$contact_options = array( + 'url' => elgg_echo("form:url"), + 'email' => elgg_echo("form:email"), + 'aim' => elgg_echo("form:aim"), + 'msn' => elgg_echo("form:msn"), + 'skype' => elgg_echo("form:skype"), + 'icq' => elgg_echo("form:icq"), +); + +$contact_radio = ''; + +foreach ($contact_options AS $value => $label) { + if ($value == $contact_type) { + $checked = 'checked'; + } else { + $checked = ''; + } + $contact_radio .= sprintf('<input type="radio" name="contact_type" value="%s" %s /> %s'."\n", $value, $checked, $label); +} + +$option_template = '<input class="option_value_input" type="text" name="option_%s_value" value="%s">'; +$option_template .= '<input class="option_label_input" type="text" name="option_%s_label" value="%s">'; +$option_template .= "<br />\n"; + +$options_bit = ''; + +if ($number_of_options > 0) { + $count = 0; + foreach($choices AS $option) { + $options_bit .= sprintf($option_template,$count,$option->value,$count,$option->label); + $count ++; + } +} + +if (!$profile) { + // currently only content forms support required fields + $required_bit = <<<END + <label class="labelclass" for="required">$required_label</label> +<input type="radio" name="required" value="0" $required_no_checked> $no +<input type="radio" name="required" value="1" $required_yes_checked> $yes +<p class="description">$required_description</p> +END; +} else { + $required_bit = ''; +} + +// define the form + +$body = <<< END +<div class="contentWrapper"> +<p>$form_description</p> +<form name="field_form" action="{$CONFIG->wwwroot}action/form/manage_field" method="post"> +<input type="hidden" name="form_action" value="$form_action"> +<input type="hidden" name="form_id" value="$form_id"> +<input type="hidden" name="field_id" value="$field_id"> +<input type="hidden" name="number_of_options" value="$number_of_options"> +<input type="hidden" name="type" value="$page_return_type"> +<input type="hidden" name="username" value="$username"> + +<label class="labelclass" for="internal_name">$internal_name_label</label> +<input type="text" class="standard" name="internal_name" value="$internal_name"> +<p class="description">$internal_name_description</p> +<label class="labelclass" for="title">$title_label</label> +<input type="text" class="standard" name="title" value="$form_title"> +<p class="description">$title_description</p> +<label class="labelclass" for="description">$description_label</label> +<input type="text" class="longer" name="description" value="$description"> +<p class="description">$description_description</p> +<label class="labelclass" for="default_value">$default_value_label</label> +<input type="text" class="standard" name="default_value" value="$default_value"> +<p class="description">$default_value_description</p> +$required_bit +<label class="labelclass" for="admin_only">$admin_only_label</label> +<input type="radio" name="admin_only" value="0" $admin_only_no_checked> $no +<input type="radio" name="admin_only" value="1" $admin_only_yes_checked> $yes +<p class="description">$admin_only_description</p> +<label class="labelclass" for="category">$category_label</label> +<input type="text" class="standard" name="category" value="$category"> +<p class="description">$category_description</p> +$profile_bit +<label class="labelclass" for="field_type">$field_type_label</label> +$field_type_select +<div id="contact_config" class="$contact_class"> + $contact_radio +</div> +<div id="choices_config" class="$choices_class"> + <br /> + <h1>$choice_header</h1> + <label class="labelclass" for="choice_type">$choice_field_type_label</label> + <input type="radio" name="choice_type" onChange="javascript:vis();" value="pulldown" $choice_type_select_checked> $dropdown + <input type="radio" name="choice_type" onChange="javascript:vis();" value="radio" $choice_type_radio_checked> $radio + <input type="radio" name="choice_type" onChange="javascript:vis();" value="checkboxes" $choice_type_checkbox_checked> $checkbox + <p class="description">$choice_field_type_description</p> + <div id="is_keyword_tag_config" class="$is_keyword_tag_class"> + <label class="labelclass" for="is_keyword_tag">$is_keyword_tag_label</label> + <input type="radio" name="is_keyword_tag" value="0" $is_keyword_tag_no_checked> $no + <input type="radio" name="is_keyword_tag" value="1" $is_keyword_tag_yes_checked> $yes + <p class="description">$is_keyword_tag_description</p> + </div> + <div id="orientation_config" class="$orientation_class"> + <label class="labelclass" for="orientation">$orientation_label</label> + <input type="radio" name="orientation" value="horizontal" $orientation_horizontal_checked> $horizontal + <input type="radio" name="orientation" value="vertical" $orientation_vertical_checked> $vertical + <p class="description">$orientation_description</p> + </div> + <div id="option_outer_container" class="$choices_class"> + <div id="option_container"> + <h1>$options_header</h1> + <span class="option_value_header">$options_value_header</span> + <span class="option_label_header">$options_label_header</span> + <br /> + $options_bit + <br /> + </div> + <p class="description">$options_description</p> + </div> + + <br /> + <input type="button" name="option_button" value="$options_add_button" onClick="add_option();"> +</div> +<div id="profile_config" class="$profile_class"> + <br /> + <h1>$profile_config_title</h1> + <br /> + <label class="labelclass" for="invisible">$invisible_label</label> + <input type="radio" name="invisible" value="0" $invisible_no_checked> $no + <input type="radio" name="invisible" value="1" $invisible_yes_checked> $yes + <p class="description">$invisible_description</p> + <label class="labelclass" for="area">$column_label</label> + <input type="radio" name="area" value="left" $area_left_checked> $profile_left + <input type="radio" name="area" value="right" $area_right_checked> $profile_right + <input type="radio" name="area" value="bottom" $area_bottom_checked> $profile_bottom + <input type="radio" name="area" value="" $area_no_checked> $no + <p class="description">$column_description</p> + <label class="labelclass" for="default_access">$access_label</label> + $access + <p class="description">$access_description</p> +</div> +<br /> +<input type="submit" value="$manage_field_button" /> +</form> +</div> +END; + +echo $body; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/manage_form.php b/plugins/mobile_unl/views/mobile/form/forms/manage_form.php new file mode 100755 index 0000000000000000000000000000000000000000..f30c46db47df4fb3647f2d89be3af411f05d1527 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/manage_form.php @@ -0,0 +1,147 @@ +<?php + + /** + * Elgg manage form view + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['form'] Optionally, the form to edit + */ + +$form = $vars['form']; +$username = $vars['form_username']; + +$profile = $vars['profile']; + +if ($form) { + if ($form->profile) { + $profile = $form->profile; + } else { + $profile = 0; + } +} + +$type_options = form_type_options(); + +if ($form) { + $form_action = 'change'; + $explanation = elgg_echo('form:form_manage_description'); + $form_manage_button = elgg_echo('form:form_manage_button'); + $form_id = $form->getGUID(); + $form_name = $form->name; + $form_title = $form->title; + $description = $form->description; + $access_id = $form->access_id; + $field_list = elgg_view('form/field_list',array('fields' => $vars['fields'],'form_id' => $form_id, 'profile' => $profile)); + + if (($profile == 0) || ($profile == 3)) { + // this bit is just for data or file forms + $display_bit = elgg_view('form/display_templates',array('form'=>$form)); + } else { + $display_bit = ''; + } + + $buttons = elgg_view('form/forms/field_adders',array('form_id'=>$form_id,'profile'=>$profile)); + $basic_tab = elgg_echo('form:basic_tab_label'); + $tab_bit= <<<END +<script type="text/javascript" src="{$vars['url']}mod/form/tabber/tabber.js"></script> +<link rel="stylesheet" href="{$vars['url']}mod/form/tabber/example.css" type="text/css" media="screen" /> +<div class="tabber"> +<div class="tabberloading" ></div> +<div class="tabbertab" title="$basic_tab"> +END; +} else { + $form_action = 'add'; + $manage_form_title = ''; + $explanation = elgg_echo('form:create_form_description'); + $form_manage_button = elgg_echo('form:create_form_button'); + $form_id = 0; + $form_name = ''; + $form_title = ''; + $description = ''; + $access_id = ACCESS_PRIVATE; + $display_bit = ''; + $field_list = ''; + $buttons = ''; + $tab_bit = ''; +} + +// top of form + +$body = <<<END +<div class="contentWrapper"> +<p>$explanation</p> +$tab_bit +<form action="{$vars['config']->wwwroot}action/form/manage_form" method="post"> +<h1>$manage_form_title</h1> +<input type="hidden" name="form_id" value="$form_id"> +<input type="hidden" name="form_action" value="$form_action"> +<input type="hidden" name="username" value="$username"> +END; + +// form name +$body .= '<label class="labelclass" for="form_name">'.elgg_echo('form:name_label').'</label>'; +$body .= elgg_view('input/text',array('internalname'=>'form_name','value'=>$form_name)); +$body .= '<p class="description">'.elgg_echo('form:name_description').'</p>'; + +// form title +$body .= '<label class="labelclass" for="form_title">'.elgg_echo('form:title_label').'</label>'; +$body .= elgg_view('input/text',array('internalname'=>'form_title','value'=>$form_title)); +$body .= '<p class="description">'.elgg_echo('form:form_title_description').'</p>'; + +// form content creation description +$body .= '<label class="labelclass" for="description">'.elgg_echo('form:description_label').'</label>'; +$body .= elgg_view('input/longtext',array('internalname'=>'description','value'=>$description)); +$body .= '<p class="description">'.elgg_echo('form:form_description_description').'</p>'; + +// form type +$body .= '<label class="labelclass" for="form_type">'.elgg_echo('form:type_label').'</label>'; +$body .= elgg_view('input/pulldown',array('internalname'=>'profile','options_values'=>$type_options,'value'=>$profile)); +$body .= '<p class="description">'.elgg_echo('form:type_description').'</p>'; + +// access levels + +$body .= '<label class="labelclass" for="access">'.elgg_echo('form:form_access_label').'</label>'; +$body .= elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); +$body .= '<p class="description">'.elgg_echo('form:form_access_description').'</p>'; + + +if ($form) { + $body .= '<input type="submit" name="submit" value="'.$form_manage_button.'">'; + $body .= '</div>'; +} +if ($profile != 3) { + // file forms don't use this + $body .= elgg_view('form/manage_form_last_bit',array('form'=>$form)); +} +$body .= $display_bit; + +if ($form) { + $body .= '</form>'; + $body .= $buttons; + $body .= '<div class="tabbertab" title="'.elgg_echo('form:field_list_tab_label').'">'; + $body .= '<h2>'.elgg_echo('form:current_fields').'</h2><br />'; + $body .= '<div id="field_list">'; + $body .= $field_list; + $body .= '</div>'; + $body .= '</div>'; +} else { + $body .= '<input type="submit" name="submit" value="'.$form_manage_button.'">'; + $body .= '</form>'; +} +// bottom of form +$body .= <<<END +</div> +END; + +if ($form) { + $body .= '</div>'; +} + +print $body; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/manage_form_translation.php b/plugins/mobile_unl/views/mobile/form/forms/manage_form_translation.php new file mode 100755 index 0000000000000000000000000000000000000000..9655668e786b6468328a132f9efd142fd1fb826d --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/manage_form_translation.php @@ -0,0 +1,111 @@ +<?php + + /** + * Elgg manage form view + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['form'] Optionally, the form to edit + */ + +$form = $vars['form']; +$form_id = $form->getGUID(); + +if ($form->translate) { + $translate = 1; +} else { + $translate = 0; +} + +echo '<div class="contentWrapper">'; + +echo '<p class="form-description">'.elgg_echo('form:translate_description').'</p>'; + +echo '</div>'; + +echo '<div class="contentWrapper">'; + +echo '<h2>'.elgg_echo('form:translation_status_title').'</h2><br />'; + +$options = array( 0=>elgg_echo('form:text_from_database'), + 1=>elgg_echo('form:use_translation_system') ); + +$body = '<form action="'.$CONFIG->wwwroot.'action/form/manage_form" method ="post" >'; +$body .= elgg_view('input/hidden',array('internalname'=>'id', 'value'=>$form->getGUID())); +$body .= elgg_view('input/hidden',array('internalname'=>'form_action', 'value'=>'translate_status')); + +$body .= elgg_view('form/input/radio',array('internalname'=>'translate','options'=>$options,'value'=>$translate)); + +$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('form:submit'))); +$body .= '</form>'; + +$body .= '</div>'; + +echo $body; + +echo '<div class="contentWrapper">'; + +echo '<h2>'.elgg_echo('form:translation_content_title').'</h2><br />'; + +echo '<p class="form-description">'.elgg_echo('form:translate_content_description').'</p>'; + +echo '<textarea style="width:100%; height:250px;">'; + +if ($form) { + echo '\'form:formtrans:'.$form->name.':title\' => "'.htmlspecialchars($form->title).'",'."\n"; + if ($form->description) + echo '\'form:formtrans:'.$form->name.':description\' => "'.htmlspecialchars($form->description).'",'."\n"; + if ($form->listing_description) + echo '\'form:formtrans:'.$form->name.':listing_description\' => "'.htmlspecialchars($form->listing_description).'",'."\n"; + if ($form->response_text) + echo '\'form:formtrans:'.$form->name.':response_text\' => "'.htmlspecialchars($form->response_text).'",'."\n"; + $tabs = array(); + $fields = $vars['fields']; + if ($fields && count($fields) > 0 ) { + foreach ($fields AS $field) { + $field_id = $field->getGUID(); + echo '\'form:fieldtrans:'.$field->internal_name.':title\' => "'.htmlspecialchars($field->title).'",'."\n"; + if ($field->description) + echo '\'form:fieldtrans:'.$field->internal_name.':description\' => "'.htmlspecialchars($field->description).'",'."\n"; + if ($field->field_type == 'choices') { + $choices = form_get_field_choices($field_id); + if ($choices) { + foreach($choices as $choice) { + echo '\'form:fieldchoicetrans:'.$field->internal_name.':'.$choice->value.'\' => "'.htmlspecialchars($choice->label).'",'."\n"; + } + } + } + + if ($field->tab && !in_array($field->tab,$tabs)) { + $tabs[] = $field->tab; + } + + } + } + $sd_list = get_entities_from_metadata('form_id',$form_id,'object','form:search_definition'); + if ($sd_list) { + foreach($sd_list as $sd) { + echo '\'form:sdtrans:'.$form->name.':'.$sd->internalname.':title\' => "'.htmlspecialchars($sd->title).'",'."\n"; + echo '\'form:sdtrans:'.$form->name.':'.$sd->internalname.':description\' => "'.htmlspecialchars($sd->description).'",'."\n"; + } + } +} + +echo '</textarea>'; + +if (count($tabs) > 0) { + echo '<br /><br /><p class="form-description">'.elgg_echo('form:tabs_translate_description').'</p>'; + echo '<textarea style="width:100%; height:100px;">'; + foreach ($tabs as $tab) { + echo '\'form:tabtrans:'.$tab.'\' => "'.$tab.'",'."\n"; + } + echo '</textarea>'; +} + +echo '</div>'; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/manage_group_profile_categories.php b/plugins/mobile_unl/views/mobile/form/forms/manage_group_profile_categories.php new file mode 100755 index 0000000000000000000000000000000000000000..6b7ac6db1b316f579f0a21de3f48095a3db57485 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/manage_group_profile_categories.php @@ -0,0 +1,32 @@ +<?php + +/** + * Manage group categories + * + * @package Elgg + * @subpackage Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + */ + +$group_profile_categories = $vars['group_profile_categories']; + +$body .= '<div class="contentWrapper">'; + +$body .= '<p class="form-description">'.elgg_echo('form:manage_group_profile_categories_description').'</p>'; + +$body .= '<form action="'.$CONFIG->wwwroot.'action/form/manage_form" method ="post" >'; +$body .= elgg_view('input/hidden',array('internalname'=>'form_action', 'value'=>'manage_group_profile_categories')); + +$body .= elgg_view('input/longtext',array('internalname'=>'group_profile_categories','value'=>$group_profile_categories)); + +$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('form:submit'))); +$body .= '</form>'; + +$body .= '</div>'; + +echo $body; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/manage_search_definition.php b/plugins/mobile_unl/views/mobile/form/forms/manage_search_definition.php new file mode 100755 index 0000000000000000000000000000000000000000..e7fd6226290cd7d879329a3d19b3f0b6c9943a21 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/manage_search_definition.php @@ -0,0 +1,93 @@ +<?php + + /** + * Elgg add search definition + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['form_id'] Optionally, the form to add a search definition for + */ + +$form = $vars['form']; +$form_id = $form->getGUID(); +if (isset($vars['search_definition_id']) && $vars['search_definition_id']) { + $form_action = 'change'; + $search_definition_id = $vars['search_definition_id']; + $sd = get_entity($search_definition_id); + $internalname = $sd->internalname; + $search_title = $sd->title; + $search_description = $sd->description; + $search_fields = $sd->search_fields; + $search_order = $sd->search_order; + //$expiryfield = $sd->expiryfield; + $menu = $sd->menu; + $button = elgg_echo('form:form_manage_button'); +} else { + $form_action = 'add'; + $search_definition_id = 0; + $internalname = ''; + $search_title = ''; + $search_description = ''; + $search_fields = ''; + $search_order = ''; + //$expiryfield = ''; + $menu = ''; + $button = elgg_echo('form:create_form_button'); +} + +$body = '<div class="contentWrapper">'; + +$body .= '<form action="'.$vars['url'].'action/form/manage_search_definition" method="post">'; + +$body .= elgg_view('input/hidden',array('internalname'=>'form_id', 'value'=>$form_id)); +$body .= elgg_view('input/hidden',array('internalname'=>'form_action', 'value'=>$form_action)); +$body .= elgg_view('input/hidden',array('internalname'=>'sid', 'value'=>$search_definition_id)); + +$body .= '<label for="internalname">'.elgg_echo('form:internalname_label'); +$body .= elgg_view('input/text',array('internalname'=>'internalname','value'=>$internalname)); +$body .= '</label>'; +$body .= '<p class="description">'.elgg_echo('form:search_definition_internalname_description').'</p>'; + +$body .= '<label for="search_title">'.elgg_echo('form:search_title_label'); +$body .= elgg_view('input/text',array('internalname'=>'search_title','value'=>$search_title)); +$body .= '</label>'; +$body .= '<p class="description">'.elgg_echo('form:search_definition_search_title_description').'</p>'; + +$body .= '<label for="search_description">'.elgg_echo('form:search_description_label'); +$body .= elgg_view('input/longtext',array('internalname'=>'search_description','value'=>$search_description)); +$body .= '</label>'; +$body .= '<p class="description">'.elgg_echo('form:search_definition_search_description_description').'</p>'; + +$body .= '<label for="search_fields">'.elgg_echo('form:search_field_label'); +$body .= elgg_view('input/text',array('internalname'=>'search_fields','value'=>$search_fields)); +$body .= '</label>'; +$body .= '<p class="description">'.elgg_echo('form:search_field_description').'</p>'; + +$body .= '<label for="search_order">'.elgg_echo('form:search_order_label'); +$body .= elgg_view('input/text',array('internalname'=>'search_order','value'=>$search_order)); +$body .= '</label>'; +$body .= '<p class="description">'.elgg_echo('form:search_order_description').'</p>'; +// TODO: replace expiryfield with the new dated entities when they become available +/*$body .= '<p><label for="expiryfield">'.elgg_echo('form:expiryfield_label'); +$body .= elgg_view('input/text',array('internalname'=>'expiryfield','value'=>$expiryfield)); +$body .= '</label></p>'; +$body .= '<p class="form-field-description">'.elgg_echo('form:expiryfield_description').'</p>';*/ + +$body .= '<label for="menu">'.elgg_echo('form:menu_label'); +$body .= elgg_view('input/text',array('internalname'=>'menu','value'=>$menu)); +$body .= '</label>'; +$body .= '<p class="description">'.elgg_echo('form:search_menu_description').'</p>'; + +$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>$button)); + +$body .= '</form>'; + +$body .= '</div>'; + +print $body; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/forms/search.php b/plugins/mobile_unl/views/mobile/form/forms/search.php new file mode 100755 index 0000000000000000000000000000000000000000..951a83b68b4b79f03e1bd83e625e6fc93c98aa30 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/forms/search.php @@ -0,0 +1,79 @@ +<?php + + /** + * Elgg display search form + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['form_id'] Optionally, the form to add a search definition for + */ + + // load form model + require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/models/model.php"); +$sd = $vars['search_definition']; +$search_definition_id = $sd->getGUID(); +$form_id = $sd->form_id; +$form = get_entity($form_id); + +$hide_category = ''; + +$hidden_fields = $vars['hidden']; +if ($hidden_fields) { + $data = array(); + $hidden = array(); + foreach ($hidden_fields as $key => $value) { + $f = new stdClass; + $f->value = $value; + $f->name = $key; + $data[$key] = $f; + $hidden[$key] = true; + if ($key == 'group_profile_category') { + // special handling + $hide_category = $value; + } + } +} + +$button = elgg_echo('form:search_button'); + +$body = '<div class="contentWrapper">'.$sd->description.'</div>'; +$body .= '<div class="contentWrapper">'; + +$body .= '<form action="'.$vars['url'].'mod/form/search_results.php" method="get">'; +$body .= elgg_view('input/hidden',array('internalname'=>'sid', 'value'=>$search_definition_id)); + +$namelist = array(); +$names = trim($sd->search_fields); +if ($names) { + foreach(explode(',',$names) as $name) { + $namelist[] = trim($name); + } + if ($hidden_fields) { + $results = form_display_filtered($form,$namelist,$data,false,$hidden); + } else { + $results = form_display_filtered($form,$namelist,null,false); + } + + if ($results) { + foreach($results as $item) { + $body .= $item->html; + } + } +} + +if ($hide_category) { + $body .= elgg_view('input/hidden',array('internalname'=>'_hide_category', 'value'=>$hide_category)); +} + +$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>$button)); + +$body .= '</form>'; +$body .= '</div>'; + +print $body; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/input/checkboxes.php b/plugins/mobile_unl/views/mobile/form/input/checkboxes.php new file mode 100755 index 0000000000000000000000000000000000000000..322eea2ed3daed72dcae3d314b4c36ec5afbcb83 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/input/checkboxes.php @@ -0,0 +1,58 @@ +<?php + + /** + * Elgg checkbox input + * Displays a checkbox input field + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * Form module version reverses $options array and adds orientation option + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['options'] An array of strings representing the options for the checkbox field + * + */ + + $class = $vars['class']; + if (!$class) $class = "input-checkboxes"; + + $orientation = $vars['orientation']; + if ($orientation == 'horizontal') { + $ending = ' '; + } else { + $ending = '<br />'; + } + + foreach($vars['options'] as $option => $label) { + //if (!in_array($option,$vars['value'])) { + if (is_array($vars['value'])) { + if (!in_array($option,$vars['value'])) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + } else { + if ($option != $vars['value']) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + } + $labelint = (int) $label; + if ("{$label}" == "{$labelint}") { + $label = $option; + } + + $disabled = ""; + if ($vars['disabled']) $disabled = ' disabled="yes" '; + echo "<label><input type=\"checkbox\" $disabled {$vars['js']} name=\"{$vars['internalname']}[]\" {$selected} value=\"".htmlentities($option, null, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label>".$ending; + } + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/input/group_categories.php b/plugins/mobile_unl/views/mobile/form/input/group_categories.php new file mode 100755 index 0000000000000000000000000000000000000000..8c0564b12dbcca188b8e61764de0d09b6676f7ba --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/input/group_categories.php @@ -0,0 +1,13 @@ +<?php +$categories = form_get_group_profile_categories(); +$options = array(); +if ($categories) { + foreach(explode("\n",$categories) as $category) { + // not sure why this trim is necessary + $category = trim($category); + $options[$category] = $category; + } +} +$vars['options'] = $options; +echo elgg_view('input/pulldown',$vars); +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/input/invite_box.php b/plugins/mobile_unl/views/mobile/form/input/invite_box.php new file mode 100755 index 0000000000000000000000000000000000000000..3b2660a1b2319d423b9b9e8c559c687502e33798 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/input/invite_box.php @@ -0,0 +1,20 @@ +<?php + + /** + * Elgg invite box view + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['internalname'] The internal name of the field + */ + + echo '<br /><b>'.elgg_echo('form:contacts').'</b><br />'; + echo elgg_view('form/input/smallbox',array('internalname'=>$vars['internalname'].'_contacts','value'=>'')); + echo '<br /><b>'.elgg_echo('form:message').'</b><br />'; + echo elgg_view('form/input/smallbox',array('internalname'=>$vars['internalname'].'_message','value'=>'')); + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/input/radio.php b/plugins/mobile_unl/views/mobile/form/input/radio.php new file mode 100755 index 0000000000000000000000000000000000000000..e609cacca462b02e9627d22d019dc82222fdad69 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/input/radio.php @@ -0,0 +1,42 @@ +<?php + + /** + * Elgg radio input + * Displays a radio input field + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['options'] An array of strings representing the options for the radio field + * + */ + + $class = $vars['class']; + if (!$class) $class = "input-radio"; + + $orientation = $vars['orientation']; + if ($orientation == 'horizontal') { + $ending = ' '; + } else { + $ending = '<br />'; + } + + foreach($vars['options'] as $option => $label) { + if ($option != $vars['value']) { + $selected = ""; + } else { + $selected = "checked = \"checked\""; + } + + if ($vars['disabled']) $disabled = ' disabled="yes" '; + echo "<label><input type=\"radio\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" value=\"".htmlentities($option, null, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label>".$ending; + } + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/input/shorttext.php b/plugins/mobile_unl/views/mobile/form/input/shorttext.php new file mode 100755 index 0000000000000000000000000000000000000000..d26f89aba2a7f9be8a8657083bccabe7d8cae3ea --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/input/shorttext.php @@ -0,0 +1,27 @@ +<?php + + /** + * Elgg text input + * Displays a text input field + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * @uses $vars['disabled'] If true then control is read-only + * @uses $vars['class'] Class override + */ + + + $class = $vars['class']; + if (!$class) $class = "input-text"; + +?> + +<input style="width:250px;" type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo htmlentities($vars['value'], null, 'UTF-8'); ?>" class="<?php echo $class ?>"/> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/input/smallbox.php b/plugins/mobile_unl/views/mobile/form/input/smallbox.php new file mode 100755 index 0000000000000000000000000000000000000000..568b69754d1f4194994619142ed9b5a38e896c69 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/input/smallbox.php @@ -0,0 +1,25 @@ +<?php + + /** + * Elgg long text input + * Displays a long text input field + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + * + * @uses $vars['value'] The current value, if any + * @uses $vars['js'] Any Javascript to enter into the input tag + * @uses $vars['internalname'] The name of the input field + * + */ + + $class = $vars['class']; + if (!$class) $class = "input-textarea"; + +?> + +<textarea style="width:250px;" class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo $vars['value']; ?></textarea> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/manage_form_last_bit.php b/plugins/mobile_unl/views/mobile/form/manage_form_last_bit.php new file mode 100755 index 0000000000000000000000000000000000000000..a9df20493f295c1de6a53a2cf0208eb27a7cd79a --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/manage_form_last_bit.php @@ -0,0 +1,154 @@ +<?php +$form = $vars['form']; +$type_options = form_type_options(); + +if ($form) { + $listing_description = $form->listing_description; + $response_text = $form->response_text; + if ($form->allow_comments) { + $allow_comments = 1; + } else { + $allow_comments = 0; + } + if ($form->allow_recommendations) { + $allow_recommendations = 1; + } else { + $allow_recommendations = 0; + } + if ($form->email_form) { + $email_form = 1; + } else { + $email_form = 0; + } + $email_to = $form->email_to; + + if ($form->enable_display_menu) { + $enable_display_menu = 1; + } else { + $enable_display_menu = 0; + } + $display_menu_title = $form->display_menu_title; + + if ($form->enable_create_menu) { + $enable_create_menu = 1; + } else { + $enable_create_menu = 0; + } + $create_menu_title = $form->create_menu_title; + + $profile = $form->profile; + if ($form->profile_format) { + $profile_format = $form->profile_format; + } else { + $profile_format = 'default'; + } + +} else { + $listing_description = ''; + $response_text = ''; + $allow_comments = 0; + $email_form = 0; + $email_to = ''; + $enable_display_menu = 0; + $display_menu_title = ''; + $enable_create_menu = 0; + $create_menu_title = ''; + $allow_recommendations = 0; + $profile_format = 'default'; +} + +$last_bit = ''; +if ($form) { + $last_bit .= '<div class="tabbertab" title="'.elgg_echo('form:last_bit_tab_label').'">'; +} + +if (($profile == 1) || ($profile == 2)) { + $format_options = array( + elgg_echo('form:profile_format_default_option_label') => 'default', + elgg_echo('form:profile_format_no_extended_option_label') => 'no_extended', + elgg_echo('form:profile_format_tabbed_option_label') => 'tabbed', + ); + + if ($profile == 2) { + $format_options[elgg_echo('form:profile_format_wide_tabbed_option_label')] = 'wide_tabbed'; + } + + if ($form) { + $last_bit .= '<input type="hidden" name="response_text" value="">'; + + $last_bit .= '<label class="labelclass" for="profile_format">'.elgg_echo('form:profile_format_label').'</label><br />'; + $last_bit .= elgg_view('input/radio', array('internalname'=>'profile_format','value'=>$profile_format,'options'=>$format_options)); + $last_bit .= '<p class="description">'.elgg_echo('form:profile_format_description').'</p>'; + + $last_bit .= '<label class="labelclass" for="profile_category">'.elgg_echo('form:profile_category_label').'</label>'; + $last_bit .= elgg_view('input/text',array('internalname'=>'profile_category','value'=>trim($form->profile_category))); + $last_bit .= '<p class="description">'.elgg_echo('form:profile_category_description').'</p>'; + + } +} else if ($profile == 0) { + // content form stuff + if ($form) { + + // form listing description + $last_bit .= '<label class="labelclass" for="form_listing_description">'.elgg_echo('form:listing_description_label').'</label>'; + $last_bit .= elgg_view('input/longtext',array('internalname'=>'form_listing_description','value'=>$listing_description)); + $last_bit .= '<p class="description">'.elgg_echo('form:form_listing_description').'</p>'; + + // response text + + $last_bit .= '<label class="labelclass" for="response_text">'.elgg_echo('form:response_text_label').'</label>'; + $last_bit .= elgg_view('input/longtext',array('internalname'=>'response_text','value'=>$response_text)); + $last_bit .= '<p class="description">'.elgg_echo('form:response_description').'</p>'; + + // email form option + + $last_bit .= '<br /><br />'; + + $last_bit .= elgg_view('input/checkboxes',array('internalname'=>'email_form','value'=>$email_form, 'options'=>array(elgg_echo('form:email_form_label')=>1))); + $last_bit .= '<p>'.elgg_echo('form:email_form_description').'</p>'; + + $last_bit .= '<label class="labelclass" for="email_to">'.elgg_echo('form:email_to_label').'</label>'; + $last_bit .= elgg_view('input/text', array('internalname'=>'email_to','value'=>$email_to)); + $last_bit .= '<p class="description">'.elgg_echo('form:email_to_description').'</p>'; + + $last_bit .= '<br /><br />'; + + // display menu option + + $last_bit .= elgg_view('input/checkboxes',array('internalname'=>'enable_display_menu','value'=>$enable_display_menu, 'options'=>array(elgg_echo('form:enable_display_menu_label')=>1))); + $last_bit .= '<p>'.elgg_echo('form:enable_display_menu_description').'</p>'; + + $last_bit .= '<label class="labelclass" for="display_menu_title">'.elgg_echo('form:display_menu_title_label').'</label>'; + $last_bit .= elgg_view('input/text', array('internalname'=>'display_menu_title','value'=>$display_menu_title)); + $last_bit .= '<p class="description">'.elgg_echo('form:display_menu_title_description').'</p>'; + + $last_bit .= '<br /><br />'; + + // create menu option + + $last_bit .= elgg_view('input/checkboxes',array('internalname'=>'enable_create_menu','value'=>$enable_create_menu, 'options'=>array(elgg_echo('form:enable_create_menu_label')=>1))); + $last_bit .= '<p>'.elgg_echo('form:enable_create_menu_description').'</p>'; + + $last_bit .= '<label class="labelclass" for="create_menu_title">'.elgg_echo('form:create_menu_title_label').'</label>'; + $last_bit .= elgg_view('input/text', array('internalname'=>'create_menu_title','value'=>$create_menu_title)); + $last_bit .= '<p class="description">'.elgg_echo('form:create_menu_title_description').'</p>'; + + $last_bit .= '<br /><br />'; + + // comment and recommendation options + + $last_bit .= '<p>'; + $last_bit .= elgg_view('input/checkboxes',array('internalname'=>'allow_comments','value'=>$allow_comments, 'options'=>array(elgg_echo('form:allow_comments_label')=>1))); + $last_bit .= elgg_view('input/checkboxes',array('internalname'=>'allow_recommendations','value'=>$allow_recommendations, 'options'=>array(elgg_echo('form:allow_recommendations_label')=>1))); + $last_bit .= '</p>'; + } + +} + +if ($form) { + $last_bit .= '<input type="submit" name="submit" value="'.elgg_echo('form:form_manage_button').'">'; + $last_bit .= '</div>'; +} + +echo $last_bit; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/missing_error.php b/plugins/mobile_unl/views/mobile/form/missing_error.php new file mode 100755 index 0000000000000000000000000000000000000000..dd9b9117e6981e15868715d8b1e5c97f9787ac9a --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/missing_error.php @@ -0,0 +1,34 @@ +<?php + +/** + * Elgg display missing error + * + * @package Elgg + * @subpackage Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + */ + + $missing = $vars['missing']; + $tabs = array(); + foreach($missing as $field) { + // order within tab + if (!isset($tabs[$field->tab])) { + $tabs[$field->tab] = array(); + } + $tabs[$field->tab][] = $field->title; + } + + $field_list = array(); + + foreach ($tabs as $tab => $fields) { + if (!$tab) { + $tab = elgg_echo('form:basic_tab_label'); + } + $field_list[] = implode(', ',$fields).' '.sprintf(elgg_echo('form:tab_bit'),$tab); + } + + print sprintf(elgg_echo('form:error_missing_fields'),implode('; ',$field_list)); +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/my_forms.php b/plugins/mobile_unl/views/mobile/form/my_forms.php new file mode 100755 index 0000000000000000000000000000000000000000..20705bf3764a27f484115391d6b8e121d9681d16 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/my_forms.php @@ -0,0 +1,88 @@ +<?php + + /** + * Elgg display search form + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['form_id'] Optionally, the form to add a search definition for + */ + + // load form model + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php"); + +$form = $vars['form']; +$form_view = $vars['form_view']; +$username = $vars['username']; +if ($username) { + $user = get_user_by_username($username); +} else { + $user = get_loggedin_user(); +} + +$form_id = $form->getGUID(); + +$offset = (int) get_input('offset',0); +$limit = 10; + +$entities = array(); + +if ($form_view == 'recommendations') { + // get all the form data with recommendations, sorted with the most recommended at the top + // TODO: replace with more efficient SQL + $all_entities = get_entities_from_annotations("object", "form_data", "form:recommendation", "", 0, 0, 5000); + if ($all_entities) { + $entity_list = array(); + foreach($all_entities as $entity) { + if ($entity->form_id == $form_id) { + $count = count_annotations($entity->getGUID(), "object", "form_data", "form:recommendation"); + $item = new StdClass(); + $item->entity = $entity; + $item->count = $count; + $entity_list[] = $item; + } + } + + $sorted = form_vsort($entity_list,'count',true); + foreach($sorted as $item) { + $entities[] = $item->entity; + } + $entities = array_slice($entities,$offset,$limit); + } +} else { + + if ($form_view == 'mine') { + $user_guid = $user->getGUID(); + } else if ($form_view == 'friends') { + // handles up to 5000 friends + $friends = $user->getFriends("", 5000); + $user_guid = array(); + if ($friends) { + foreach ($friends as $friend) { + $user_guid[] = $friend->getGUID(); + } + } + } else if ($form_view == 'all') { + $user_guid = 0; + } + + if (!is_array($user_guid) || count($user_guid) > 0) { + + $count = get_entities_from_metadata('form_id', $form_id, 'object', 'form_data', $user_guid, $limit, $offset, "", 0, true); + $entities = get_entities_from_metadata('form_id', $form_id, 'object', 'form_data', $user_guid, $limit, $offset, "", 0, false); + } +} + +if ($entities) { + echo '<div class="form_listing">'; + echo form_view_entity_list($entities, $form, $count, $offset, $limit, false, true); + echo '</div>'; +} else { + echo elgg_echo('form:no_search_results'); +} + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/nav.php b/plugins/mobile_unl/views/mobile/form/nav.php new file mode 100755 index 0000000000000000000000000000000000000000..dfcefbc830d0886071b00a5528aa706594d90918 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/nav.php @@ -0,0 +1,26 @@ +<?php +$allselect = ''; $friendsselect = ''; $mineselect = ''; +switch($vars['form_view']) { + case 'all': $allselect = 'class="selected"'; + break; + case 'friends': $friendsselect = 'class="selected"'; + break; + case 'recommendations': $recommendedselect = 'class="selected"'; + break; + case 'mine': $mineselect = 'class="selected"'; + break; +} + +$url_start = $vars['url'].'mod/form/my_forms.php?id='.$vars['form_id'].'&mode='.$vars['mode']; + +?> +<div id="elgg_horizontal_tabbed_nav"> + <ul> + <li <?php echo $allselect; ?> ><a onclick="javascript:$('#form_wrapper').load('<?php echo $url_start; ?>&form_view=all&callback=true'); return false;" href="<?php echo $url_start; ?>&form_view=all&callback=true"><?php echo elgg_echo('all'); ?></a></li> + <?php if ($vars['enable_recommendations']) {?> + <li <?php echo $recommendedselect; ?> ><a onclick="javascript:$('#form_wrapper').load('<?php echo $url_start; ?>&form_view=recommendations&callback=true'); return false;" href="<?php echo $url_start; ?>&form_view=recommendations&callback=true"><?php echo elgg_echo('form:recommended'); ?></a></li> + <? } ?> + <li <?php echo $friendsselect; ?> ><a onclick="javascript:$('#form_wrapper').load('<?php echo $url_start; ?>&form_view=friends&callback=true'); return false;" href="<?php echo $url_start; ?>&form_view=friends&callback=true"><?php echo elgg_echo('friends'); ?></a></li> + <li <?php echo $mineselect; ?> ><a onclick="javascript:$('#form_wrapper').load('<?php echo $url_start; ?>&form_view=mine&callback=true'); return false;" href="<?php echo $url_start; ?>&form_view=mine&callback=true"><?php echo elgg_echo('mine'); ?></a></li> + </ul> +</div> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/output/choice.php b/plugins/mobile_unl/views/mobile/form/output/choice.php new file mode 100755 index 0000000000000000000000000000000000000000..e0168d434e308dada6e5d7db69ecde6072af8e24 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/output/choice.php @@ -0,0 +1,55 @@ +<?php + +/** + * Elgg choice + * Displays a choice option linked to a search + * + * Tags can be a single string (for one tag) or an array of strings + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['option'] The choice option + * @uses $vars['label'] The label + * @uses $vars['internalname'] The internal name of the field + * @uses $vars['form_id'] The form_id + */ + +$type = $vars['type']; +$value = $vars['value']; +$internalname = $vars['internalname']; +$form_id = $vars['form_id']; + +if ($type == 'form_data') { + $qs = "type=form_data&form_id=$form_id"; +} else { + $qs = "type=$type"; +} + +if (is_array($value)) { + $value_array = array(); + foreach($value as $key => $label) { + if (!$label) { + $label = $key; + } + $value_bit = "&form_data[$internalname]=".urlencode($key); + $value_array[] = '<a href="'.$vars['url'].'mod/form/search_results_simple.php?'.$qs.$value_bit.'">'.$label.'</a>'; + } + echo implode(', ',$value_array); +} else { + + if (empty($vars['label'])) { + $label = $value; + } else { + $label = $vars['label']; + } + + $qs .= "&form_data[$internalname]=".urlencode($value); + + echo '<a href="'.$vars['url'].'mod/form/search_results_simple.php?'.$qs.'">'.$label.'</a>'; +} + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/output/image.php b/plugins/mobile_unl/views/mobile/form/output/image.php new file mode 100755 index 0000000000000000000000000000000000000000..7db638b86ea4f6decaf8d3a811d66b56586f7cc5 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/output/image.php @@ -0,0 +1,11 @@ +<?php + +$value = trim($vars['value']); +$size = trim($vars['size']); +if (!$size) { + $size = 'large'; +} + +print '<img src="'.$vars['url'].'/mod/file/thumbnail.php?size='.$size.'&file_guid='.$value.'">'; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/output/longtext_no_p.php b/plugins/mobile_unl/views/mobile/form/output/longtext_no_p.php new file mode 100755 index 0000000000000000000000000000000000000000..3ce4c6dcdbb00c90dbb8842290743c232c419113 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/output/longtext_no_p.php @@ -0,0 +1,36 @@ +<?php + + /** + * Elgg display long text, no_p + * Displays a large amount of text, with new lines converted to line breaks + * + * This version modified to remove paragraph wrapper and replace internal + * paragraph tags with <br /><br /> + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2009 + * @link http://elgg.org/ + * + * @uses $vars['text'] The text to display + * + */ + + global $CONFIG; + + $value = trim(autop(parse_urls(filter_tags($vars['value'])))); + + // strip off last </p> if any + if (substr($value,strlen($value)-4,4) == '</p>') { + $value = substr($value,0,strlen($value)-4); + } + // eliminate <p> tags + $value = str_replace('<p>','',$value); + // replace </p> tags with <br /><br /> + $value = str_replace('</p>','<br /><br />',$value); + + echo $value; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/output/tags.php b/plugins/mobile_unl/views/mobile/form/output/tags.php new file mode 100755 index 0000000000000000000000000000000000000000..c73ba9cc1e0911a9fd0854f9be6266c33c675cf7 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/output/tags.php @@ -0,0 +1,44 @@ +<?php + +/** + * Elgg tags + * Displays a list of tags, separated by commas + */ + +if (!empty($vars['subtype'])) { + $subtype = "&subtype=" . urlencode($vars['subtype']); +} else { + $subtype = ""; +} +if (!empty($vars['object'])) { + $object = "&object=" . urlencode($vars['object']); +} else { + $object = ""; +} + +if (empty($vars['tags']) && !empty($vars['value'])) +$vars['tags'] = $vars['value']; +if (!empty($vars['tags'])) { + + $tagstr = ""; + if (!is_array($vars['tags'])) + $vars['tags'] = array($vars['tags']); + + foreach($vars['tags'] as $tag) { + if (!empty($tagstr)) { + $tagstr .= ", "; + } + if (!empty($vars['type'])) { + $type = "&type={$vars['type']}"; + } else { + $type = ""; + } + if (is_string($tag)) { + $vars['value'] = $tag; + $tagstr .= elgg_view('form/output/choice',$vars); + } + } + echo $tagstr; + +} +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/output/video_box.php b/plugins/mobile_unl/views/mobile/form/output/video_box.php new file mode 100755 index 0000000000000000000000000000000000000000..9b4127b3774ebf04b2b15f2fb7872adb3c2c42e0 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/output/video_box.php @@ -0,0 +1,36 @@ +<?php + +$value = trim($vars['value']); +$pos1 = strpos($value, "="); +if ($pos1 !== false) { + $pos2 = strpos($value,"&",$pos1+1); + if ($pos2 !== false) { + $value=substr($value,$pos1+1,$pos2-$pos1-1); + } else { + $value = substr($value, $pos1+1); + } + + $size = $vars['size']; + if (!$size) { + $size = 'full'; + } + if ($size == 'thumb') { + print '<img src="http://img.youtube.com/vi/'.$value.'/2.jpg" />'; + } else { + + +?> + +<object width="425" height="344"> +<param name="movie" value="http://www.youtube.com/v/<?php echo $value; ?>&hl=en&fs=1"></param> +<param name="allowFullScreen" value="true"></param> +<embed src="http://www.youtube.com/v/<?php echo $value; ?>&hl=en&fs=1" +type="application/x-shockwave-flash" allowfullscreen="true" +width="425" height="344"> +</embed> +</object> + +<?php + } +} +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/response.php b/plugins/mobile_unl/views/mobile/form/response.php new file mode 100755 index 0000000000000000000000000000000000000000..86ebc4c65b9ea386de2df7653e50e7e10b41befc --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/response.php @@ -0,0 +1,11 @@ +<?php +$form = $vars['form']; +$body = '<div class="contentWrapper">'; +if (trim($form->response_text)) { + $body .= '<p class="form-response">'.$form->response_text.'</p>'; +} else { + $body .= '<p class="form-response">'.elgg_echo('form:default_response_text').'</p>'; +} +$body .= '</div>'; +echo $body; +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/search/listing.php b/plugins/mobile_unl/views/mobile/form/search/listing.php new file mode 100755 index 0000000000000000000000000000000000000000..34f89e055d710d4f386393fab91b85ecd568ce9c --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/search/listing.php @@ -0,0 +1,38 @@ +<?php + + /** + * Elgg search listing + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + if (isset($vars['search_viewtype']) && $vars['search_viewtype'] == "gallery") { + + echo elgg_view("search/gallery_listing",$vars); + + } else { + +?> + + <div class="search_listing"> + + <!--div class="search_listing_info"--> + <?php + + echo $vars['info']; + + ?> + <!--/div --> + + </div> + +<?php + + } + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/search_results.php b/plugins/mobile_unl/views/mobile/form/search_results.php new file mode 100755 index 0000000000000000000000000000000000000000..d7bbb028def1a1921cfcf8a33aacd3f75bff1275 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/search_results.php @@ -0,0 +1,52 @@ +<?php + + /** + * Elgg display search form + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['form_id'] Optionally, the form to add a search definition for + */ + + // load form model + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php"); + +$sd = $vars['search_definition']; +$fd = form_get_data_from_form_submit($sd->form_id); + +$form = get_entity($sd->form_id); + +$offset = (int) get_input('offset',0); +$limit = 5; + +$search_page_link = '<p><a href="'.$vars['url'].'mod/form/search.php?sid='.$sd->getGUID().'" >'.elgg_echo('form:return_to_search').'</a></p>'; + +//echo $search_page_link; +echo '<div class="contentWrapper">'; +echo '<div class="form_listing">'; + +$result = form_get_data_with_search_conditions($fd,$sd,$limit,$offset); + +$count = $result[0]; +$entities = $result[1]; + +if ($entities) { + if (($form->profile == 1) || ($form->profile == 2)) { + echo elgg_view_entity_list($entities, $count, $offset, $limit, false, false); + } else { + echo form_view_entity_list($entities, $form, $count, $offset, $limit, false, false); + } +} else { + echo '<p>'.elgg_echo('form:no_search_results').'</p>'; +} + +echo '</div>'; +echo '</div>'; + +//echo $search_page_link; + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/search_results_simple.php b/plugins/mobile_unl/views/mobile/form/search_results_simple.php new file mode 100755 index 0000000000000000000000000000000000000000..fe32bc4b219939ed8680d9c0023a0b35beb61327 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/search_results_simple.php @@ -0,0 +1,60 @@ +<?php + + /** + * Elgg display search form + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + * @uses $vars['form_id'] Optionally, the form to add a search definition for + */ + + // load form model + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php"); + // load form profile model + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/profile.php"); + +$type = get_input('type',''); + +$fd = get_input('form_data',array()); + +if ($type == 'user') { + // load flexprofile model + require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/flexprofile/models/model.php"); + $form = flexprofile_get_profile_form(); +} else if ($type == 'group') { + // load flexgroupprofile model + require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/flexgroupprofile/models/model.php"); + $form = flexgroupprofile_get_profile_form(); + set_context('groups'); +} else if ($type == 'file') { + // load flexgroupprofile model + require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/flexfile/models/model.php"); + $form = flexfile_get_file_form(); + set_context('file'); +} else { + $form_id = (int) get_input('form_id',0); + $form = get_entity($form_id); +} + +$offset = (int) get_input('offset',0); +$limit = 5; + +$result = form_get_data_with_search_conditions_simple($fd,$type,$form->getGUID(),$limit,$offset); +$count = $result[0]; +$entities = $result[1]; + +if ($entities) { + if (($form->profile == 1) || ($form->profile == 2)) { + echo elgg_view_entity_list($entities, $count, $offset, $limit, false, false); + } else { + echo form_view_entity_list($entities, $form, $count, $offset, $limit, false, false); + } +} else { + echo '<p>'.elgg_echo('form:no_search_results').'</p>'; +} + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/form/settings/usersettings.php b/plugins/mobile_unl/views/mobile/form/settings/usersettings.php new file mode 100755 index 0000000000000000000000000000000000000000..7dbb7864da198b648a940624d7d7b2a7ea6e6012 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/form/settings/usersettings.php @@ -0,0 +1,27 @@ +<?php + /** + * User settings for forms. + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + */ + $key = 'form:view_content_languages'; + $form_view_languages = $_SESSION['user']->$key; + if ($form_view_languages) { + $form_view_languages = explode(",",$form_view_languages); + } else { + $form_view_languages = array(); + } + $languages = get_installed_translations(); +?> + <h3><?php echo elgg_echo('form:usersettings_title'); ?></h3> + + <p><?php echo elgg_echo('form:usersettings_description'); ?></p> + +<?php + echo elgg_view('form/input/checkboxes',array('internalname' => "form_view_language", 'options' => $languages, 'value' => $form_view_languages)); + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/object/form.php b/plugins/mobile_unl/views/mobile/object/form.php new file mode 100755 index 0000000000000000000000000000000000000000..d072431d39eef942bcade41ab275ecb41a28942d --- /dev/null +++ b/plugins/mobile_unl/views/mobile/object/form.php @@ -0,0 +1,74 @@ +<?php +/** + * Elgg form display + * Displays the specified Elgg form + * + * @package Elgg + * @subpackage Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + */ + + +// Load form model +require_once(dirname(dirname(dirname(dirname(__FILE__))))."/models/model.php"); + +$form = $vars['entity']; + +$tab_data = array(); +$title = $form->title; +$maps = form_get_maps($form_id); +if ($maps) { + foreach($maps as $map) { + $field = get_entity($map->field_id); + $vars = array('internalname'=>$field->internal_name,'value'=>$field->default_value); + //print($field->internal_name.','.$field->field_type.','.$field->choice_type.','.$field->default_value.'<br />'); + if ($field->field_type == 'choices') { + $vars['orientation'] = $field->orientation; + $field_type = $field->choice_type; + $choices = form_get_field_choices($field->getGUID()); + if ($choices) { + if ($choices[0]->label) { + $options_values = array(); + foreach($choices as $choice) { + $options_values[$choice->value] = $choice->label; + } + $vars['options_values'] = $options_values; + } else { + $options = array(); + foreach($choices as $choice) { + $options[$choice->value] = $choice->value; + } + $vars['options'] = $options; + } + } + + } else { + $field_type = $field->field_type; + } + $view = 'input/'.$field_type; + if (in_array($field_type, array('radio','checkboxes'))) { + // use the local view + $view = 'form/'.$view; + } + //print($view.'<br />'); + if (!$field->tab) { + $tab = elgg_echo('form:basic_tab_label'); + } else { + // TODO - allow forms to get this data from the translation file rather than directly + $tab = $field->tab; + } + + if (!isset($tab_data[$tab])) { + $tab_data[$tab] = ''; + } + $tab_data[$tab] .= elgg_view('form/display_field', array('field'=>elgg_view($view,$vars), + 'title'=>$field->title,'description'=>$field->description)); + } +} + +echo elgg_view('form/display_form', array('description'=>$form->description,'tab_data'=>$tab_data)); + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/object/form_data.php b/plugins/mobile_unl/views/mobile/object/form_data.php new file mode 100755 index 0000000000000000000000000000000000000000..6d990e7d2b100f0b2cbfd0418dc9d4bcce394050 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/object/form_data.php @@ -0,0 +1,23 @@ +<?php + + /** + * Elgg display search form + * + * @package Form + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Kevin Jardine <kevin@radagast.biz> + * @copyright Radagast Solutions 2008 + * @link http://radagast.biz/ + * + */ + + // load form model + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php"); + +$form_data = $vars['entity']; +$form = get_entity($form_data->form_id); +if ($form) { + echo form_view_entities(array($form_data), $form, 'list'); +} + +?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/river/object/form_data/annotate.php b/plugins/mobile_unl/views/mobile/river/object/form_data/annotate.php new file mode 100755 index 0000000000000000000000000000000000000000..f8409ef5c39e5671b9a38b03d83eb97b8052b737 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/river/object/form_data/annotate.php @@ -0,0 +1,13 @@ +<?php + $performed_by = get_entity($vars['item']->subject_guid); + $object = get_entity($vars['item']->object_guid); + $form_title = get_entity($object->form_id)->title; + + $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; + $string = ''; + $string .= sprintf(elgg_echo("form:river:commented"),$url) . " "; + $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("form:river:this_content") . "</a> ".sprintf(elgg_echo("form:river:destination"),$form_title); + +?> + +<?php echo $string; ?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/river/object/form_data/create.php b/plugins/mobile_unl/views/mobile/river/object/form_data/create.php new file mode 100755 index 0000000000000000000000000000000000000000..a477dd617e94c35c5b5f49885667ad6a3164bde0 --- /dev/null +++ b/plugins/mobile_unl/views/mobile/river/object/form_data/create.php @@ -0,0 +1,13 @@ +<?php + $performed_by = get_entity($vars['item']->subject_guid); + $object = get_entity($vars['item']->object_guid); + $form_title = get_entity($object->form_id)->title; + + $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; + $string = ''; + $string .= sprintf(elgg_echo("form:river:created"),$url) . " "; + $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("form:river:this_content") . "</a> ".sprintf(elgg_echo("form:river:destination"),$form_title); + +?> + +<?php echo $string; ?> \ No newline at end of file diff --git a/plugins/mobile_unl/views/mobile/settings/form/edit.php b/plugins/mobile_unl/views/mobile/settings/form/edit.php new file mode 100755 index 0000000000000000000000000000000000000000..01798eeee0560fe09f570a916e9744820ab173fa --- /dev/null +++ b/plugins/mobile_unl/views/mobile/settings/form/edit.php @@ -0,0 +1,20 @@ +<?php +$options = array(elgg_echo('form:yes')=>'yes', + elgg_echo('form:no')=>'no', +); + +if (form_get_user_content_status()) { + $form_user_content_area = 'yes'; +} else { + $form_user_content_area = 'no'; +} + +$body = ''; + +$body .= elgg_echo('form:user_content_status_title'); +$body .= '<br />'; +$body .= elgg_view('input/radio',array('internalname'=>'params[user_content_area]','value'=>$form_user_content_area,'options'=>$options)); + +echo $body; + +?> \ No newline at end of file