From 3187b984cc76491bf1aabacdf8b2deb5046eaf0a Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 9 Dec 2010 20:54:16 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Bundle=20Commands=20-=20added=20shell=20var?= =?UTF-8?q?s=20SP=5FCURRENT=5FEDITED=5FCOLUMN=5FNAME,=20SP=5FCURRENT=5FEDI?= =?UTF-8?q?TED=5FTABLE=20for=20Input=20Field=20scoped=20commands=20if=20in?= =?UTF-8?q?voked=20from=20a=20table=20cell=20field=20editor=20-=20added=20?= =?UTF-8?q?shell=20var=20SP=5FTABLE=5FDATA=5FSOURCE=20(content=20or=20quer?= =?UTF-8?q?y)=20-=20fixed=20table=20row=20change=20trigger=20for=20custom?= =?UTF-8?q?=20query=20tableView?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTextViewAdditions.m | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Source/SPTextViewAdditions.m') diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index 6ca111b5..c85b5c51 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -578,6 +578,31 @@ [env setObject:bundleInputFilePath forKey:SPBundleShellVariableInputFilePath]; [env setObject:SPBundleScopeInputField forKey:SPBundleShellVariableScope]; + + id tableSource = [self delegate]; + if([[[tableSource class] description] isEqualToString:@"SPCopyTable"]) { + NSInteger editedCol = [tableSource editedColumn]; + if(editedCol > -1) { + NSString *colName = [[[[tableSource tableColumns] objectAtIndex:editedCol] headerCell] stringValue]; + if([[[[tableSource dataSource] class] description] hasSuffix:@"Content"]) { + [env setObject:[colName description] forKey:SPBundleShellVariableCurrentEditedColumnName]; + [env setObject:@"content" forKey:SPBundleShellVariableDataTableSource]; + } else { + NSArray *defs = [[tableSource delegate] dataColumnDefinitions]; + for(NSDictionary* col in defs) { + if([[col objectForKey:@"name"] isEqualToString:colName]) { + [env setObject:[col objectForKey:@"org_name"] forKey:SPBundleShellVariableCurrentEditedColumnName]; + [env setObject:[col objectForKey:@"org_table"] forKey:SPBundleShellVariableCurrentEditedTable]; + break; + } + } + [env setObject:@"query" forKey:SPBundleShellVariableDataTableSource]; + } + if([[tableSource delegate] respondsToSelector:@selector(usedQuery)] && [[tableSource delegate] usedQuery]) + [env setObject:[[tableSource delegate] usedQuery] forKey:SPBundleShellVariableUsedQueryForTable]; + } + } + if(selfIsQueryEditor && [[self delegate] currentQueryRange].length) [env setObject:[[self string] substringWithRange:[[self delegate] currentQueryRange]] forKey:@"SP_CURRENT_QUERY"]; -- cgit v1.2.3 From 370e35a72e344c5a2c29ff76cdf1e84b4f475807 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 9 Dec 2010 21:26:48 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Bundle=20commands=20-=20added=20the=20shell?= =?UTF-8?q?=20vars=20for=20edited=20field=20info=20as=20well=20if=20Field?= =?UTF-8?q?=20Editor=20sheet=20is=20used?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTextViewAdditions.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Source/SPTextViewAdditions.m') diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index c85b5c51..5dd7d06c 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -578,9 +578,16 @@ [env setObject:bundleInputFilePath forKey:SPBundleShellVariableInputFilePath]; [env setObject:SPBundleScopeInputField forKey:SPBundleShellVariableScope]; - id tableSource = [self delegate]; - if([[[tableSource class] description] isEqualToString:@"SPCopyTable"]) { + if([[[tableSource class] description] isEqualToString:@"SPFieldEditorController"]) { + NSDictionary *editedFieldInfo = [tableSource editedFieldInfo]; + [env setObject:[editedFieldInfo objectForKey:@"colName"] forKey:SPBundleShellVariableCurrentEditedColumnName]; + if([editedFieldInfo objectForKey:@"tableName"]) + [env setObject:[editedFieldInfo objectForKey:@"tableName"] forKey:SPBundleShellVariableCurrentEditedTable]; + [env setObject:[editedFieldInfo objectForKey:@"usedQuery"] forKey:SPBundleShellVariableUsedQueryForTable]; + [env setObject:[editedFieldInfo objectForKey:@"tableSource"] forKey:SPBundleShellVariableDataTableSource]; + } + else if([[[tableSource class] description] isEqualToString:@"SPCopyTable"]) { NSInteger editedCol = [tableSource editedColumn]; if(editedCol > -1) { NSString *colName = [[[[tableSource tableColumns] objectAtIndex:editedCol] headerCell] stringValue]; -- cgit v1.2.3