|
@@ -46,6 +46,7 @@
|
|
|
#import "FileCache.h"
|
|
#import "FileCache.h"
|
|
|
#import "RAConvertor.h"
|
|
#import "RAConvertor.h"
|
|
|
#import "EnumSelectAndSortViewController.h"
|
|
#import "EnumSelectAndSortViewController.h"
|
|
|
|
|
+#import "CommonEditorRangeCell.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -55,7 +56,7 @@
|
|
|
|
|
|
|
|
@implementation subitem_data
|
|
@implementation subitem_data
|
|
|
@end
|
|
@end
|
|
|
-@interface CommonEditorViewController ()
|
|
|
|
|
|
|
+@interface CommonEditorViewController ()<CommonEditorRangeDelegate>
|
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
@end
|
|
@@ -67,48 +68,48 @@
|
|
|
|
|
|
|
|
self.editorTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
|
self.editorTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
|
|
self.editorTable.translatesAutoresizingMaskIntoConstraints = NO;
|
|
self.editorTable.translatesAutoresizingMaskIntoConstraints = NO;
|
|
|
- [self.view addSubview:self.editorTable];
|
|
|
|
|
- [self.view sendSubviewToBack:self.editorTable];
|
|
|
|
|
|
|
+ [self.tableContainer addSubview:self.editorTable];
|
|
|
|
|
+ [self.tableContainer sendSubviewToBack:self.editorTable];
|
|
|
|
|
|
|
|
NSLayoutConstraint *top_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
NSLayoutConstraint *top_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
|
attribute:NSLayoutAttributeTop
|
|
attribute:NSLayoutAttributeTop
|
|
|
relatedBy:NSLayoutRelationEqual
|
|
relatedBy:NSLayoutRelationEqual
|
|
|
- toItem:self.view
|
|
|
|
|
|
|
+ toItem:self.tableContainer
|
|
|
attribute:NSLayoutAttributeTop
|
|
attribute:NSLayoutAttributeTop
|
|
|
multiplier:1
|
|
multiplier:1
|
|
|
constant:0];
|
|
constant:0];
|
|
|
self.tb_top_constraint = top_constraint;
|
|
self.tb_top_constraint = top_constraint;
|
|
|
- [self.view addConstraint:top_constraint];
|
|
|
|
|
|
|
+ [self.tableContainer addConstraint:top_constraint];
|
|
|
|
|
|
|
|
NSLayoutConstraint *left_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
NSLayoutConstraint *left_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
|
attribute:NSLayoutAttributeLeft
|
|
attribute:NSLayoutAttributeLeft
|
|
|
relatedBy:NSLayoutRelationEqual
|
|
relatedBy:NSLayoutRelationEqual
|
|
|
- toItem:self.view
|
|
|
|
|
|
|
+ toItem:self.tableContainer
|
|
|
attribute:NSLayoutAttributeLeft
|
|
attribute:NSLayoutAttributeLeft
|
|
|
multiplier:1
|
|
multiplier:1
|
|
|
constant:0];
|
|
constant:0];
|
|
|
self.tb_left_constraint = left_constraint;
|
|
self.tb_left_constraint = left_constraint;
|
|
|
- [self.view addConstraint:left_constraint];
|
|
|
|
|
|
|
+ [self.tableContainer addConstraint:left_constraint];
|
|
|
|
|
|
|
|
NSLayoutConstraint *bottom_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
NSLayoutConstraint *bottom_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
|
attribute:NSLayoutAttributeBottom
|
|
attribute:NSLayoutAttributeBottom
|
|
|
relatedBy:NSLayoutRelationEqual
|
|
relatedBy:NSLayoutRelationEqual
|
|
|
- toItem:self.view
|
|
|
|
|
|
|
+ toItem:self.tableContainer
|
|
|
attribute:NSLayoutAttributeBottom
|
|
attribute:NSLayoutAttributeBottom
|
|
|
multiplier:1
|
|
multiplier:1
|
|
|
constant:0];
|
|
constant:0];
|
|
|
self.tb_bottom_constraint = bottom_constraint;
|
|
self.tb_bottom_constraint = bottom_constraint;
|
|
|
- [self.view addConstraint:bottom_constraint];
|
|
|
|
|
|
|
+ [self.tableContainer addConstraint:bottom_constraint];
|
|
|
|
|
|
|
|
NSLayoutConstraint *right_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
NSLayoutConstraint *right_constraint = [NSLayoutConstraint constraintWithItem:self.editorTable
|
|
|
attribute:NSLayoutAttributeRight
|
|
attribute:NSLayoutAttributeRight
|
|
|
relatedBy:NSLayoutRelationEqual
|
|
relatedBy:NSLayoutRelationEqual
|
|
|
- toItem:self.view
|
|
|
|
|
|
|
+ toItem:self.tableContainer
|
|
|
attribute:NSLayoutAttributeRight
|
|
attribute:NSLayoutAttributeRight
|
|
|
multiplier:1
|
|
multiplier:1
|
|
|
constant:0];
|
|
constant:0];
|
|
|
self.tb_right_constraint = right_constraint;
|
|
self.tb_right_constraint = right_constraint;
|
|
|
- [self.view addConstraint:right_constraint];
|
|
|
|
|
|
|
+ [self.tableContainer addConstraint:right_constraint];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -132,7 +133,7 @@
|
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Signature_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellSignature"];
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Signature_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellSignature"];
|
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Switch_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellSwitch"];
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Switch_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellSwitch"];
|
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_TextView_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellTextView"];
|
|
[self.editorTable registerNib:[UINib nibWithNibName:@"Phone_TextView_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorCellTextView"];
|
|
|
-
|
|
|
|
|
|
|
+ [self.editorTable registerNib:[UINib nibWithNibName:@"Phone_Range_Cell" bundle:nil] forCellReuseIdentifier:@"CommonEditorRangeCell"];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)setupEditorTable {
|
|
- (void)setupEditorTable {
|
|
@@ -3925,6 +3926,31 @@
|
|
|
// CommonEditorCellSignature* cell = (CommonEditorCellSignature*) [self.editorTable cellForRowAtIndexPath:indexPath];
|
|
// CommonEditorCellSignature* cell = (CommonEditorCellSignature*) [self.editorTable cellForRowAtIndexPath:indexPath];
|
|
|
//cell.imageviewSignature.image = image;
|
|
//cell.imageviewSignature.image = image;
|
|
|
}
|
|
}
|
|
|
|
|
+ else if ([control isEqualToString:@"range"]) {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *type = [item_json objectForKey:@"type"];
|
|
|
|
|
+ NSString *keyboard = [item_json objectForKey:@"keyboard"];
|
|
|
|
|
+ NSString *title = [item_json objectForKey:@"aname"];
|
|
|
|
|
+ NSString *min = [item_json objectForKey:@"min_value"];
|
|
|
|
|
+ NSString *max = [item_json objectForKey:@"max_value"];
|
|
|
|
|
+
|
|
|
|
|
+ CommonEditorRangeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CommonEditorRangeCell" forIndexPath:indexPath];
|
|
|
|
|
+ cell.indexPath = indexPath;
|
|
|
|
|
+ cell.delegate = self;
|
|
|
|
|
+ [cell setTitle:title];
|
|
|
|
|
+ [cell setMinValue:min maxValue:max];
|
|
|
|
|
+ if ([type isEqualToString:@"date"]) {
|
|
|
|
|
+ [cell setType:CommonEditorRangeTypeDate];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ [cell setType:CommonEditorRangeTypeDefault];
|
|
|
|
|
+ }
|
|
|
|
|
+ if([keyboard isEqualToString:@"number"]) {
|
|
|
|
|
+ [cell setKeyboardType:UIKeyboardTypeDecimalPad];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ [cell setKeyboardType:UIKeyboardTypeDefault];
|
|
|
|
|
+ }
|
|
|
|
|
+ return cell;
|
|
|
|
|
+ }
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
CellIdentifier = @"CommonEditorCellEdit";
|
|
CellIdentifier = @"CommonEditorCellEdit";
|
|
@@ -5799,7 +5825,35 @@
|
|
|
// [self moveInputBarWithKeyboardHeight:0.0 withDuration:animationDuration];
|
|
// [self moveInputBarWithKeyboardHeight:0.0 withDuration:animationDuration];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#pragma mark - RageCell Delegate
|
|
|
|
|
|
|
|
|
|
+- (void)commonEditorRangeCell:(CommonEditorRangeCell *)cell didChangeMinValue:(NSString *)minValue maxValue:(NSString *)maxValue atIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
|
+ if (indexPath == nil) {
|
|
|
|
|
+ if (cell != nil) {
|
|
|
|
|
+ indexPath = [self.editorTable indexPathForCell:cell];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (indexPath == nil) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ NSString *section_key = [NSString stringWithFormat:@"section_%ld",indexPath.section];
|
|
|
|
|
+ NSString *item_key = [NSString stringWithFormat:@"item_%ld",indexPath.row];
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableDictionary *section_json = [[self.content_data_download objectForKey:section_key] mutableCopy];
|
|
|
|
|
+ NSMutableDictionary *item_json = [((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
|
|
|
|
|
+
|
|
|
|
|
+ [item_json setObject:minValue forKey:@"min_value"];
|
|
|
|
|
+ [item_json setObject:maxValue forKey:@"max_value"];
|
|
|
|
|
+
|
|
|
|
|
+ [section_json setObject:item_json forKey:item_key];
|
|
|
|
|
+ [self.content_data_download setObject:section_json forKey:section_key];
|
|
|
|
|
+ self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
@end
|
|
@end
|
|
|
|
|
|