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';
41 parent::__construct();
59 $conn = @$asset->connectToLdap();
61 if (is_null($conn) || is_null($conn->ptr)) {
63 echo
'<span style="color: red"><b>'.translate(
'ldap_unable_to_connect').
'</b></span>';
65 echo
'<span style="color: green"><b>'.translate(
'ldap_connected').
'</b></span>';
103 $configured_options = $asset->attr(
'ldap_options');
106 foreach ($asset->getConnectionOptions() as $option => $checked_value) {
108 if (isset($configured_options[$option])) {
112 if ($asset->writeAccess(
'attributes')) {
113 $element_name = $prefix.
'_ldap_options['.$option.
']';
115 check_box($element_name, $checked_value, $checked);
117 <label
for=
"<?php echo $element_name; ?>"><?php echo translate(
'option_'.strtolower($option)); ?></label><br />
120 $display_image =
'cross';
121 if ($checked) $display_image =
'tick';
123 $mask =
'<img src="'.sq_web_path(
'lib').
'/web/images/'.$display_image.
'.gif" />';
124 echo $mask.
' '.translate(
'option_'.strtolower($option)).
'<br />';
127 return $asset->writeAccess(
'attributes');
144 $configured_options = Array();
145 $element_name = $prefix.
'_ldap_options';
148 foreach ($asset->getConnectionOptions() as $option => $value) {
149 if (isset($_REQUEST[$element_name][$option])) {
150 $configured_options[$option] = $value;
155 $asset->setAttrValue(
'ldap_options', $configured_options);
157 return $asset->writeAccess(
'attributes');
175 $ldap_bridge_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'ldap_bridge', FALSE,
'ldap_bridge');
176 if (empty($ldap_bridge_link)) {
177 $ldap_bridge_asset_id = NULL;
179 $ldap_bridge_asset_id = $ldap_bridge_link[
'minorid'];
182 if ($asset->writeAccess(
'links')) {
183 asset_finder($prefix.
'_ldap_bridge', $ldap_bridge_asset_id, Array(
'ldap_bridge'=>
'D'));
185 if (empty($ldap_bridge_asset_id)) {
186 echo
'No LDAP bridge selected';
188 echo get_asset_tag_line($ldap_bridge_asset_id);
208 $new_ldap_bridge_id = @$_REQUEST[$prefix.
'_ldap_bridge'][
'assetid'];
210 if (!$asset->writeAccess(
'links')) {
214 $current_ldap_bridge_link = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_NOTICE,
'ldap_bridge', FALSE,
'ldap_bridge');
215 $current_ldap_bridge_asset_id = @$current_ldap_bridge_link[
'minorid'];
217 if (!empty($current_ldap_bridge_link)) {
220 if ((!empty($new_ldap_bridge_id)) && ($current_ldap_bridge_asset_id === $new_ldap_bridge_id)) {
225 $GLOBALS[
'SQ_SYSTEM']->am->deleteAssetLink($current_ldap_bridge_link[
'linkid']);
229 if (empty($new_ldap_bridge_id))
return TRUE;
233 if (!empty($new_ldap_bridge_id)) {
234 $new_ldap_bridge_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($new_ldap_bridge_id);
235 $result_id = $GLOBALS[
'SQ_SYSTEM']->am->createAssetLink($asset, $new_ldap_bridge_asset, SQ_LINK_NOTICE,
'ldap_bridge');
236 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($new_ldap_bridge_asset);
238 if (empty($result_id)) {
239 trigger_error(
'Could not link the ldap_bridge to this asset', E_USER_WARNING);
262 <p
class=
"sq-backend-warning"><strong><?php echo translate(
'ldap_not_available_line_1'); ?></strong></p>
263 <p><?php echo translate(
'ldap_not_available_line_2'); ?></p>
295 return extension_loaded(
'ldap');
327 $wa = $asset->writeAccess(
'attributes');
328 $search_filter = $asset->attr(
'search_filter');
331 $dynamic_vars = $asset->attr(
'dynamic_vars');
332 if (!empty($dynamic_vars)) {
333 foreach ($dynamic_vars as $var => $value) {
334 $keywords[
'%%'.$var.
'%%'] = $var;
336 keyword_selector($keywords, $prefix.
'_search_filter');
338 text_area($prefix.
'_search_filter', $search_filter, 60, 100, 0,
'style="width: 100%; height: 30em; font-family: \'Courier New\', Courier, monospace; display: block"');
340 if (!empty($search_filter)) {
341 echo nl2br($search_filter);
342 hidden_field($prefix.
'_search_filter', $search_filter);
364 if (isset($_POST[$prefix.
'_search_filter'])) {
365 return $asset->setAttrValue(
'search_filter', $_POST[$prefix.
'_search_filter']);