17 require_once SQ_INCLUDE_PATH.
'/asset_edit/asset_edit_fns.inc';
18 require_once SQ_CORE_PACKAGE_PATH.
'/data_source/data_source/data_source_edit_fns.inc';
19 require_once SQ_PACKAGES_PATH.
'/sharepoint/lib/sharepoint_common.inc';
42 parent::__construct();
43 $this->static_screens[
'details'][
'force_unlock'] = FALSE;
63 $write_access = $asset->writeAccess(
'attributes');
65 $current_search_options = $asset->attr(
'search_options');
67 $available_operators = Array (
74 'Contains' =>
'Contains',
75 'BeginsWith' =>
'BeginsWith',
76 'IsNotNull' =>
'IsNotNull',
83 $connection = $asset->getConnection();
84 $data_list = $asset->attr(
'data_list');
85 $search_logic = $asset->attr(
'search_logic');
86 $row_limit = $asset->attr(
'row_limit');
87 $available_fields = Array(
'None' =>
'');
89 if (!empty($data_list) && $data_list !=
'None') {
93 if (isset($sp_available_fields[
'LinkFilename'])) {
94 unset($sp_available_fields[
'LinkFilename']);
96 if (isset($sp_available_fields[
'LinkFilenameNoMenu'])) {
97 unset($sp_available_fields[
'LinkFilenameNoMenu']);
99 if (isset($sp_available_fields[
'BaseName'])) {
100 unset($sp_available_fields[
'BaseName']);
103 foreach ($sp_available_fields as $raw_name => $display_name) {
104 $sp_available_fields[$raw_name] = $display_name.
' ('.$raw_name.
')';
107 $available_fields += $sp_available_fields;
110 $options = array_get_index($current_search_options, $data_list, Array());
113 <span
class=
"sq-backend-section-subheading" style=
"margin-left:60px;">Row Limit</span><br />
115 if (!$write_access) {
116 echo
'<span style="margin:5 0 20 120px;font-weight:bold;">'.$row_limit.
'</span>';
118 text_box($prefix.
'_row_limit', $row_limit, 4,
'', FALSE,
'style="margin:7 0 20 120px;"');
119 ?><span style=
"margin-left:0px;"> This limit the number of records returned.</span><?php
122 if (!empty($options)) {
125 <span
class=
"sq-backend-section-subheading" style=
"margin-left:60px;">Search Logic</span><br />
127 if (!$write_access) {
128 echo
'<span style="margin:5 0 20 120px;font-weight:bold;">'.strtoupper($search_logic).
'</span>';
130 combo_box($prefix.
'_search_logic', Array(
'And' =>
'AND',
'Or' =>
'OR'), FALSE, $search_logic, 0,
' style="margin:7 0 20 120px;"');
137 <p
class=
"sq-backend-section-subheading" style=
"margin-left:60px;">Criterion</p>
138 <table
class=
"sq-backend-table" style=
"width:auto; margin-left:120px;">
142 <?php
if ($write_access) { ?>
149 foreach ($options as $index => $field_info) {
150 $field_name = key($field_info);
151 $crit = $field_info[$field_name];
152 $field_name_info = isset($available_fields[$field_name]) ? $available_fields[$field_name] :
'';
157 <td style=
"width:330px;"><p><?php combo_box($prefix.
'_edit_field_name['.$index.
']', $available_fields, FALSE, $field_name); ?></p></td>
158 <td><?php combo_box($prefix.
'_edit_op['.$index.
']', $available_operators, FALSE, $crit[
'operator']); ?></td>
159 <td><p><?php text_box($prefix.
'_edit_val['.$index.
']', $crit[
'value'], 50); ?></p></td>
160 <td><?php check_box($prefix.
'_delete_crit['.$data_list.
']['.$field_name.
']'); ?></td>
167 <td style=
"width:330px;"><p><?php echo $available_fields[$field_name]; ?></p></td>
168 <td align=
"center"><?php echo $available_operators[$crit[
'operator']]; ?></td>
169 <td><p><?php echo $crit[
'value']; ?></p></td>
183 <p
class=
"sq-backend-section-subheading" style=
"margin-left:60px;">Add New Criteria</p>
184 <table
class=
"sq-backend-table" style=
"width:auto; margin-left:120px;">
189 <td style=
"width:330px;"><?php combo_box($prefix.
'_new_search_criteria_field', $available_fields, FALSE); ?></td>
190 <td><?php combo_box($prefix.
'_new_search_criteria_operator', $available_operators, FALSE); ?></td>
191 <td><p><?php text_box($prefix.
'_new_search_criteria_value',
'', 50); ?></p></td>
204 return $write_access;
221 $criteria_field = array_get_index($_POST, $prefix.
'_new_search_criteria_field', NULL);
222 $criteria_operator = array_get_index($_POST, $prefix.
'_new_search_criteria_operator', NULL);
223 $criteria_value = array_get_index($_POST, $prefix.
'_new_search_criteria_value', NULL);
224 $search_logic = array_get_index($_POST, $prefix.
'_search_logic',
'And');
225 $row_limit = array_get_index($_POST, $prefix.
'_row_limit',
'');
228 if (!empty($row_limit) && $row_limit > 0) {
229 $asset->setAttrValue(
'row_limit', $row_limit);
232 $editing_criterion = array_get_index($_POST, $prefix.
'_edit_val', Array());
233 $editing_operator = array_get_index($_POST, $prefix.
'_edit_op', Array());
234 $editing_field_name = array_get_index($_POST, $prefix.
'_edit_field_name', Array());
236 $current_search_options = $asset->attr(
'search_options');
237 $current_data_list = $asset->attr(
'data_list');
239 if (isset($current_search_options[$current_data_list])) {
240 foreach ($current_search_options[$current_data_list] as $index => $field_info) {
241 foreach ($editing_criterion as $edit_val_index => $new_value) {
242 if (isset($current_search_options[$current_data_list][$edit_val_index])) {
243 $field_crit_info_1 = $current_search_options[$current_data_list][$edit_val_index];
244 $field_crit_value = $field_crit_info_1[key($field_crit_info_1)][
'value'];
245 if ($field_crit_value != $new_value) {
246 $current_search_options[$current_data_list][$edit_val_index][key($field_crit_info_1)][
'value'] = $new_value;
251 foreach ($editing_operator as $edit_op_index => $new_operator) {
252 if (isset($current_search_options[$current_data_list][$edit_op_index])) {
253 $field_crit_info_2 = $current_search_options[$current_data_list][$edit_op_index];
254 $field_crit_op = $field_crit_info_2[key($field_crit_info_2)][
'operator'];
255 if ($field_crit_op != $new_operator) {
256 $current_search_options[$current_data_list][$edit_op_index][key($field_crit_info_2)][
'operator'] = $new_operator;
261 foreach ($editing_field_name as $edit_fn_index => $new_field_name) {
262 if (isset($current_search_options[$current_data_list][$edit_fn_index])) {
263 $field_crit_info_3 = $current_search_options[$current_data_list][$edit_fn_index];
264 $field_crit_fn = key($field_crit_info_3);
265 if ($field_crit_fn != $new_field_name) {
266 $current_search_options[$current_data_list][$edit_fn_index][$new_field_name] = $field_crit_info_3[$field_crit_fn];
267 unset($current_search_options[$current_data_list][$edit_fn_index][$field_crit_fn]);
274 $new_data_list = array_get_index($_POST, $prefix.
'_data_list',
'');
275 if ($new_data_list != $current_data_list && !empty($new_data_list)) {
276 $asset->setAttrValue(
'data_list', $new_data_list);
278 $current_data_list = $asset->attr(
'data_list');
280 if (!empty($criteria_field) && $criteria_field !=
'None' && !is_null($criteria_value)) {
281 $new_criteria = Array (
282 'operator' => $criteria_operator,
283 'value' => $criteria_value,
286 $current_search_options[$current_data_list][] = Array (
287 $criteria_field => $new_criteria,
291 $delete_array = array_get_index($_POST, $prefix.
'_delete_crit', Array());
293 if (!empty($delete_array) && isset($delete_array[$current_data_list])) {
294 foreach ($current_search_options[$current_data_list] as $index => $field_info) {
295 foreach ($delete_array[$current_data_list] as $remove_field_name => $value) {
296 if (key($field_info) == $remove_field_name) {
297 unset($current_search_options[$current_data_list][$index]);
303 $asset->setAttrValue(
'search_logic', $search_logic);
304 $asset->setAttrValue(
'search_options', $current_search_options);
323 $connection = $asset->getConnection();
325 $wa = $asset->writeAccess(
'attributes');
326 require_once SQ_PACKAGES_PATH.
'/sharepoint/lib/sharepoint_common.inc';
329 if (!empty($connection[
'url'])) {
334 echo
'<span style="color:green;font-weight:bold">Connected</span>';
336 echo
'<span style="color:red;font-weight:bold">Not Connected</span>';
370 $write_access = $asset->writeAccess(
'attributes');
371 $wsdl = $asset->attr(
'url');
373 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
374 text_box($prefix.
'_sys_url', $wsdl,
'35');
379 return $write_access;
394 if (!$asset->writeAccess(
'attributes'))
return FALSE;
397 $old_wsdl = $asset->attr(
'url');
398 if (!empty($_POST[$prefix.
'_sys_url'])) {
399 $new_wsdl = trim($_POST[$prefix.
'_sys_url']);
400 if ($old_wsdl != $new_wsdl) {
401 $res = $asset->setAttrValue(
'url', $new_wsdl);
425 $connector_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'sharepoint_connector', FALSE,
'sharepoint_connector');
426 if (empty($connector_link)) {
427 $connector_asset_id = NULL;
429 $connector_asset_id = $connector_link[
'minorid'];
432 if ($asset->writeAccess(
'links')) {
433 asset_finder($prefix.
'_connector_node', $connector_asset_id, Array(
'sharepoint_connector'=>
'D'));
435 if (empty($connector_asset_id)) {
436 echo
'No connector selected';
438 echo get_asset_tag_line($connector_asset_id);
458 $new_connector_id = @$_REQUEST[$prefix.
'_connector_node'][
'assetid'];
460 if (!$asset->writeAccess(
'links')) {
464 $current_connector_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'sharepoint_connector', FALSE,
'sharepoint_connector');
465 $current_connector_asset_id = @$current_connector_link[
'minorid'];
467 if (!empty($current_connector_link)) {
470 if ((!empty($new_connector_id)) && ($current_connector_asset_id === $new_connector_id)) {
475 $GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($current_connector_link[
'linkid']);
479 if (empty($new_connector_id))
return TRUE;
483 if (!empty($new_connector_id)) {
484 $new_connector_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($new_connector_id);
485 $result_id = $GLOBALS[
'SQ_SYSTEM']->am->createAssetLink($asset, $new_connector_asset, SQ_LINK_NOTICE,
'sharepoint_connector');
487 if (empty($result_id)) {
488 trigger_error(
'Could not link the connector to this asset', E_USER_WARNING);
511 $write_access = $asset->writeAccess(
'attributes');
513 $current_data_list = $asset->attr(
'data_list');
514 if ($current_data_list ==
'') $current_data_list =
'None';
515 $connection = $asset->getConnection();
516 $list_names = Array (
521 if (isset($connection[
'url']) && !empty($connection[
'url'])) {
527 $list_names += $sp_lists;
530 if (!$write_access) {
531 if (isset($list_names[$current_data_list])) {
532 echo $list_names[$current_data_list];
535 combo_box($prefix.
'_data_list', $list_names, FALSE, $current_data_list);
553 $write_access = $asset->writeAccess(
'attributes');
554 if (!$write_access)
return FALSE;
556 $new_data_list = array_get_index($_POST, $prefix.
'_data_list',
'');
557 $current_data_list = $asset->attr(
'data_list');
558 if ($new_data_list != $current_data_list) {
559 $asset->setAttrValue(
'data_list', $new_data_list);
579 $wa = $asset->writeAccess(
'attributes');
582 <script type=
"text/javascript" src=
"<?php echo sq_web_path('data').'/asset_types/sharepoint_saved_search/js/ajax.js' ?>"></script>
584 <div style=
"position:relative;top:0px;">
585 <table style=
"width:auto;border-spacing:0px;" border=
"0">
587 <td width=
"90"><span style=
"font-weight:bold;">Check Update</span><br /><br /></td>
588 <td width=
"150"><span
id=
"update_text">Not Checked</span><br /><br /></td>
590 <td><?php
if ($wa) normal_button($prefix.
'_synch',
'Synchronize Now',
'sendRequest(\''.$asset->getURL().
'?synch_now=1\', \'updateSynchInterface\');'); ?><br /><br /></td>
629 $write_access = $asset->writeAccess(
'attributes');
631 $download_file_attr = $asset->attr(
'download_file');
636 if (!$write_access) {
637 echo $download_file_attr ?
"Yes" :
"No";
639 combo_box($prefix.
'_download_file', $options, FALSE, $download_file_attr);
657 $write_access = $asset->writeAccess(
'attributes');
658 if (!$write_access)
return FALSE;
659 $download_file_attr = array_get_index($_POST, $prefix.
'_download_file', 1);
660 $current_download_file_attr = $asset->attr(
'download_file');
662 if ($current_download_file_attr != $download_file_attr) {
663 $asset->setAttrValue(
'download_file', $download_file_attr);