function insert_s_title_display_mask_item($stdm_id, $s_item_type_group, $s_item_type, $display_mask) { if (strlen($stdm_id) > 0 && strlen($s_item_type_group) > 0 && strlen($s_item_type) > 0 && strlen($display_mask) > 0) { // ensure parent record exists if (is_exists_s_title_display_mask($stdm_id)) { if (($s_item_type_group == '*' || is_exists_item_type_group($s_item_type_group)) && ($s_item_type == '*' || is_exists_item_type($s_item_type))) { $query = "INSERT INTO s_title_display_mask_item (stdm_id, s_item_type_group, s_item_type, display_mask) " . "VALUES ('{$stdm_id}', '{$s_item_type_group}', '{$s_item_type}', '" . addslashes(trim(strip_tags($display_mask))) . "')"; $insert = db_query($query); if ($insert && db_affected_rows() > 0) { opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, NULL, array($stdm_id, $s_item_type_group, $s_item_type, $display_mask)); return TRUE; } else { opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, db_error(), array($stdm_id, $s_item_type_group, $s_item_type, $display_mask)); return FALSE; } } else { opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Invalid s_item_type_group or s_item_type', array($stdm_id, $s_item_type_group, $s_item_type, $display_mask)); return FALSE; } } else { opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Parent s_title_display_mask not found', array($stdm_id, $s_item_type_group, $s_item_type, $display_mask)); return FALSE; } } //else return FALSE; }
function insert_s_item_listing_conf($s_item_type_group, $s_item_type) { if (strlen($s_item_type_group) > 0 && strlen($s_item_type) > 0) { if (($s_item_type_group == '*' || is_exists_item_type_group($s_item_type_group)) && ($s_item_type == '*' || is_exists_item_type($s_item_type))) { $query = "INSERT INTO s_item_listing_conf (s_item_type_group, s_item_type) " . "VALUES ('{$s_item_type_group}', '{$s_item_type}')"; $insert = db_query($query); if ($insert && db_affected_rows() > 0) { $new_sequence_number = db_insert_id(); opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, NULL, array($s_item_type_group, $s_item_type)); return $new_sequence_number; } else { opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, db_error(), array($s_item_type_group, $s_item_type)); return FALSE; } } else { return FALSE; } } //else return FALSE; }
//delete parent too delete_s_item_listing_conf($HTTP_VARS['silc_id']); } } } $HTTP_VARS['op'] = 'edit'; } else { //if(is_exists_s_item_listing_conf($HTTP_VARS['silc_id'])) // error no item found! $HTTP_VARS['op'] = ''; } } // in edit mode, either its a new entry, in which case s_item_type_group / s_item_type is chosen, or its // an existing item, in which case the silc_id will be provided. if ($HTTP_VARS['op'] == 'edit') { if (($HTTP_VARS['s_item_type_group'] == '*' || is_exists_item_type_group($HTTP_VARS['s_item_type_group'])) && ($HTTP_VARS['s_item_type'] == '*' || is_exists_item_type($HTTP_VARS['s_item_type']))) { echo get_javascript("admin/s_item_listing_conf/rowutils.js"); echo '<style> .dataHighlight {background-color: #BDC7F7;font-size: x-small;font-weight: normal;font-family: Verdana, Arial, Helvetica, sans-serif; padding-left: 4px; padding-right: 4px;} </style>'; echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}\">Back to Main</a>]</p>"; if ($HTTP_VARS['s_item_type_group'] != '*') { echo "\n<h3>Edit Item Type Group " . $HTTP_VARS['s_item_type_group'] . " Item Listing Configuration</h3>"; } else { if ($HTTP_VARS['s_item_type'] != '*') { echo "\n<h3>Edit Item Type " . $HTTP_VARS['s_item_type'] . " Item Listing Configuration</h3>"; } else { echo "\n<h3>Edit Default Item Listing Configuration</h3>"; } } if (is_not_empty_array($errors)) {
/** This function is to be called from listings.php, for either a s_item_type_group or s_item_type. if s_item_type is defined, thats used first, otherwise we rely on s_item_type_group */ function get_s_item_listing_column_conf_rs($s_item_type_group, $s_item_type) { $silc_id = NULL; if (strlen($s_item_type) > 0 && $s_item_type != '*' && is_exists_item_type($s_item_type)) { $silc_id = fetch_s_item_listing_conf_id(NULL, $s_item_type); } else { if (strlen($s_item_type_group) > 0 && $s_item_type_group != '*' && is_exists_item_type_group($s_item_type_group)) { $silc_id = fetch_s_item_listing_conf_id($s_item_type_group, NULL); } } if (!is_numeric($silc_id)) { // get the default $silc_id = fetch_s_item_listing_conf_id(NULL, NULL); } if (is_exists_s_item_listing_column_conf($silc_id)) { $results = fetch_s_item_listing_column_conf_rs($silc_id); if ($results) { while ($item_listing_column_conf_r = db_fetch_assoc($results)) { // special indicator that this column is an item listings configuration column and should be // left in the listings page even if exact match on this column is being performed. $item_listing_column_conf_r['item_listing_conf_ind'] = 'Y'; $item_listing_column_conf_rs[] = $item_listing_column_conf_r; } db_free_result($results); } return $item_listing_column_conf_rs; } else { return array(array(column_type => 's_field_type', s_field_type => 'TITLE'), array(column_type => 'action_links'), array(column_type => 's_field_type', s_field_type => 'OWNER'), array(column_type => 's_field_type', s_field_type => 'STATUSTYPE'), array(column_type => 's_field_type', s_field_type => 'CATEGORY')); } }