add: Thingy asset

This commit is contained in:
Yung Han Khoe 2008-03-13 19:06:18 +00:00
parent cd62f71573
commit 9de7e34112
10 changed files with 4411 additions and 2 deletions

View file

@ -10,6 +10,7 @@
- ensure proper XML encoding for ITransact messages
- fixed: fatal error duplicate keywords added to a wiki page
- rfe: added the ability to choose whether assets should be added to the front or end of the first content position of the page (Dept of State)
- Added Thingy asset
7.5.5
- fixed: Several typos in the new Calendar help documentation.

View file

@ -24,6 +24,7 @@ my $session = start(); # this line required
convertCacheToBinary($session);
addLayoutOrderSetting( $session );
installThingyAsset($session);
finish($session); # this line required
@ -58,7 +59,86 @@ sub addLayoutOrderSetting {
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Install the Thingy asset
sub installThingyAsset {
my $session = shift;
print "\tInstalling Thingy asset..." unless $quiet;
$session->db->write(<<'ENDSQL');
create table if not exists Thingy (
assetId varchar(22) binary not null,
revisionDate bigint not null,
templateId varchar(22) not null,
defaultThingId varchar(22),
primary key (assetId, revisionDate)
)
ENDSQL
$session->db->write(<<'ENDSQL');
create table if not exists Thingy_things (
assetId varchar(22) binary not null,
thingId varchar(22) binary not null,
label varchar(255) not null,
editScreenTitle varchar(255) not null,
editInstructions text,
groupIdAdd varchar(22) not null,
groupIdEdit varchar(22) not null,
saveButtonLabel varchar(255) not null,
afterSave varchar(255) not null,
editTemplateId varchar(22) not null,
onAddWorkflowId varchar(22),
onEditWorkflowId varchar(22),
onDeleteWorkflowId varchar(22),
groupIdView varchar(22) not null,
viewTemplateId varchar(22) not null,
defaultView varchar(255) not null,
searchScreenTitle varchar(255) not null,
searchDescription text,
groupIdSearch varchar(22) not null,
groupIdImport varchar(22) not null,
groupIdExport varchar(22) not null,
searchTemplateId varchar(22) not null,
thingsPerPage int(11) not null default 25,
sortBy varchar(22),
display int(11),
primary key (thingId)
)
ENDSQL
$session->db->write(<<'ENDSQL');
create table if not exists Thingy_fields (
assetId varchar(22) binary not null,
thingId varchar(22) binary not null,
fieldId varchar(22) not null,
sequenceNumber int(11) not null,
dateCreated bigint(20) not null,
createdBy varchar(22) not null,
dateUpdated bigint(20) not null,
updatedBy varchar(22) not null,
label varchar(255) not null,
fieldType varchar(255) not null,
defaultValue varchar(255),
possibleValues varchar(255),
subText varchar(255),
status varchar(255) not null,
width int(11),
height int(11),
vertical smallint(1),
extras varchar(255),
display int(11),
viewScreenTitle int(11),
displayInSearch int(11),
searchIn int(11),
fieldInOtherThingId varchar(22),
primary key (fieldId, thingId, assetId)
)
ENDSQL
$session->config->addToArray("assets","WebGUI::Asset::Wobject::Thingy");
print "DONE!\n" unless $quiet;
}
# --------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------

View file

@ -235,8 +235,9 @@
"WebGUI::Asset::Wobject::InOutBoard",
"WebGUI::Asset::File::ZipArchive",
"WebGUI::Asset::Wobject::WSClient",
"WebGUI::Asset::Wobject::SQLForm"
],
"WebGUI::Asset::Wobject::SQLForm",
"WebGUI::Asset::Wobject::Thingy"
],
# Specify the list assets that are used for utility purposes only
# and are not typically used as a normal part of content

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,232 @@
package WebGUI::Help::Asset_Thingy;
our $HELP = {
'thingy template' => {
title => 'thingy template label',
body => '',
fields => [],
isa => [
{ namespace => "Asset_Thingy",
tag => "thingy asset template variables"
},
{ namespace => "Asset_Template",
tag => "template variables"
},
],
variables => [
{ 'name' => 'things_loop',
'variables' => [
{ 'name' => 'thing_editIcon' },
{ 'name' => 'thing_deleteIcon' },
{ 'name' => 'thing_viewIcon' },
{ 'name' => 'thing_label' },
{ 'name' => 'thing_id' },
{ 'name' => 'thing_editUrl' },
{ 'name' => 'thing_deleteUrl' },
{ 'name' => 'thing_searchUrl' },
{ 'name' => 'thing_addUrl' },
]
},
],
related => [
{ tag => 'edit thing template',
namespace => 'Asset_Thingy'
},
{ tag => 'view thing template',
namespace => 'Asset_Thingy'
},
{ tag => 'search thing template',
namespace => 'Asset_Thingy'
},
]
},
'edit thing template' => {
title => 'edit thing template label',
body => '',
fields => [],
isa => [
{ namespace => "Asset_Thingy",
tag => "thingy asset template variables"
},
{ namespace => "Asset_Template",
tag => "template variables"
},
],
variables => [
{ 'name' => 'delete_url' },
{ 'name' => 'delete_confirm' },
{ 'name' => 'search_url' },
{ 'name' => 'add_url' },
{ 'name' => 'editScreenTitle' },
{ 'name' => 'editInstructions' },
{ 'name' => 'error_loop',
'variables' => [ { 'name' => 'error_message' } ]
},
{ 'name' => 'field_loop',
'variables' => [
{ 'name' => 'field_isHidden' },
{ 'name' => 'field_isRequired' },
{ 'name' => 'field_isDisplayed' },
{ 'name' => 'field_label' },
{ 'name' => 'field_form' },
{ 'name' => 'field_name' },
{ 'name' => 'field_value' },
{ 'name' => 'field_subtext' },
]
},
{ 'required' => 1,
'name' => 'form_start'
},
{ 'required' => 1,
'name' => 'form_submit'
},
{ 'required' => 1,
'name' => 'form_end'
}
],
related => [
{ tag => 'thingy template',
namespace => 'Asset_Thingy'
},
{ tag => 'view thing template',
namespace => 'Asset_Thingy'
},
{ tag => 'search thing template',
namespace => 'Asset_Thingy'
},
]
},
'view thing template' => {
title => 'view thing template label',
body => '',
isa => [
{ namespace => "Asset_Thingy",
tag => "thingy asset template variables"
},
{ namespace => "Asset_Template",
tag => "template variables"
},
],
fields => [],
variables => [
{ 'name' => 'delete_url' },
{ 'name' => 'delete_confirm' },
{ 'name' => 'search_url' },
{ 'name' => 'add_url' },
{ 'name' => 'edit_url' },
{ 'name' => 'viewScreenTitle' },
{ 'name' => 'field_loop',
'variables' => [
{ 'name' => 'field_isHidden' },
{ 'name' => 'field_label' },
{ 'name' => 'field_value' },
{ 'name' => 'field_name' },
{ 'name' => 'field_id' },
{ 'name' => 'field_url' },
]
}
],
related => [
{ tag => 'edit thing template',
namespace => 'Asset_Thingy'
},
{ tag => 'search thing template',
namespace => 'Asset_Thingy'
},
{ tag => 'thingy template',
namespace => 'Asset_Thingy'
},
]
},
'search thing template' => {
title => 'search thing template label',
body => '',
fields => [],
isa => [
{ namespace => "Asset_Thingy",
tag => "thingy asset template variables"
},
{ namespace => "Asset_Template",
tag => "template variables"
},
],
variables => [
{ 'name' => 'add_url' },
{ 'name' => 'import_url' },
{ 'name' => 'export_url' },
{ 'name' => 'searchScreenTitle' },
{ 'name' => 'searchDescription' },
{ 'name' => 'searchFields_loop',
'variables' => [
{ 'name' => 'searchFields_fieldId' },
{ 'name' => 'searchFields_searchForm' },
{ 'name' => 'searchFields_label' },
]
},
{ 'required' => 1,
'name' => 'form_start'
},
{ 'required' => 1,
'name' => 'form_submit'
},
{ 'required' => 1,
'name' => 'form_end'
},
{ 'name' => 'displayInSearchFields_loop',
'variables' => [
{ 'name' => 'displayInSearchFields_fieldId' },
{ 'name' => 'displayInSearchFields_orderByUrl' },
{ 'name' => 'displayInSearchFields_label' },
]
},
{ 'name' => 'searchResult_loop',
'variables' => [
{ 'name' => 'searchResult_id' },
{ 'name' => 'searchResult_view_url' },
{ 'name' => 'searchResult_edit_icon' },
{ 'name' => 'searchResult_delete_icon' },
{ 'name' => 'searchResult_field_loop',
'variables' => [
{ 'name' => 'field_id' },
{ 'name' => 'field_value' },
]
},
]
},
],
related => [
{ tag => 'edit thing template',
namespace => 'Asset_Thingy'
},
{ tag => 'view thing template',
namespace => 'Asset_Thingy'
},
{ tag => 'thingy template',
namespace => 'Asset_Thingy'
},
]
},
'thingy asset template variables' => {
private => 1,
title => 'data form asset template variables title',
body => 'data form asset template variables body',
isa => [
{ namespace => "Asset_Wobject",
tag => "wobject template variables"
},
],
fields => [],
variables => [
{ 'name' => 'canEditThings' },
{ 'name' => 'manage_url' },
{ 'name' => 'addThing_url' },
],
related => []
},
};
1;

View file

@ -0,0 +1,877 @@
package WebGUI::i18n::English::Asset_Thingy;
our $I18N = {
'cache timeout' => {
message => q|Cache Timeout|,
lastUpdated => 0
},
'cache timeout help' => {
message => q|Since all users will see this asset the same way, we can cache it for long periods of time to increase performance. How long should we cache it?<br /> <br /><b>UI Level: 8</b>|,
lastUpdated => 0
},
'assetName' => {
message => q|Thingy|,
lastUpdated => 1128830080,
context => 'Default name of all snippets'
},
'template_label' => {
message => q|Thingy List Template|,
lastUpdated => 1121703035,
},
'add thing label' => {
message => q|Add Thing|,
lastUpdated => 1104630516,
},
'default thing label' => {
message => q|Default Thing|,
lastUpdated => 1104630516,
},
'manage things label' => {
message => q|Manage Things|,
lastUpdated => 1104630516,
},
'delete thing warning' => {
message => q|Are you sure you want to delete this Thing and all data in it? This is not versioned and can not be undone.|,
lastUpdated => 1104630516,
},
'delete thing data warning' => {
message => q|Are you sure you want to delete this thing? This is not versioned and cannot be undone.|,
lastUpdated => 1104630516,
},
'fields tab label' => {
message => q|Fields|,
lastUpdated => 1104630516,
},
'edit screen tab label' => {
message => q|Edit Screen|,
lastUpdated => 1104630516,
},
'view screen tab label' => {
message => q|View Screen|,
lastUpdated => 1104630516,
},
'search screen tab label' => {
message => q|Search Screen|,
lastUpdated => 1104630516,
},
'edit thing title' => {
message => q|Edit/Add Thing|,
lastUpdated => 1104630516,
},
'thing name label' => {
message => q|Thing Name|,
lastUpdated => 1104630516,
},
'fields label' => {
message => q|Fields|,
lastUpdated => 1104630516,
},
'add field label' => {
message => q|Add Field|,
lastUpdated => 1104630516,
},
'edit screen title label' => {
message => q|Edit screen title|,
lastUpdated => 1104630516,
},
'edit screen title description' => {
message => q|The title of the edit screen|,
lastUpdated => 1104630516,
},
'edit instructions label' => {
message => q|Instructions|,
lastUpdated => 1104630516,
},
'edit instructions description' => {
message => q|Instructions on the edit screen about adding or editing a thing.|,
lastUpdated => 1104630516,
},
'who can add label' => {
message => q|Who can add?|,
lastUpdated => 1104630516,
},
'who can add description' => {
message => q|The group that can add this thing.|,
lastUpdated => 1104630516,
},
'who can edit label' => {
message => q|Who can edit?|,
lastUpdated => 1104630516,
},
'who can edit description' => {
message => q|The group that can edit this thing.|,
lastUpdated => 1104630516,
},
'save button label label' => {
message => q|Save Button Label|,
lastUpdated => 1104630516,
},
'default save button label' => {
message => q|Save|,
lastUpdated => 1104630516,
},
'save button label description' => {
message => q|The label of the save button on the edit sceen.|,
lastUpdated => 1104630516,
},
'after save label' => {
message => q|After Save|,
lastUpdated => 1104630516,
},
'search this thing label' => {
message => q|Search this Thing|,
lastUpdated => 1104630516,
},
'view last edited label' => {
message => q|View Last Edited/Added|,
lastUpdated => 1104630516,
},
'search other thing label' => {
message => q|Search Other Thing: |,
lastUpdated => 1104630516,
},
'add other thing label' => {
message => q|Add Other Thing: |,
lastUpdated => 1104630516,
},
'view thingy default label' => {
message => q|View Thingy Default|,
lastUpdated => 1104630516,
},
'after save description' => {
message => q|The screen that is displayed after saving this thing|,
lastUpdated => 1104630516,
},
'edit template label' => {
message => q|Edit Template|,
lastUpdated => 1104630516,
},
'edit template description' => {
message => q|edit template is used to display the view screen of this thing.|,
lastUpdated => 1104630516,
},
'on add workflow label' => {
message => q|On Add|,
lastUpdated => 1104630516,
},
'on add workflow description' => {
message => q|Workflow that is triggered after adding this thing|,
lastUpdated => 1104630516,
},
'on edit workflow label' => {
message => q|On Edit|,
lastUpdated => 1104630516,
},
'on edit workflow description' => {
message => q|Workflow that is triggered after editing this thing|,
lastUpdated => 1104630516,
},
'on delete workflow label' => {
message => q|On Delete|,
lastUpdated => 1104630516,
},
'on delete workflow description' => {
message => q|Workflow that is triggered after deleting this thing|,
lastUpdated => 1104630516,
},
'who can view label' => {
message => q|Who can view?|,
lastUpdated => 1104630516,
},
'who can view description' => {
message => q|The group that can view this thing.|,
lastUpdated => 1104630516,
},
'view template label' => {
message => q|View Template|,
lastUpdated => 1104630516,
},
'view template description' => {
message => q|This template is used to display the view screen of this thing.|,
lastUpdated => 1104630516,
},
'search thing label' => {
message => q|Search|,
lastUpdated => 1104630516,
},
'default view label' => {
message => q|Default View|,
lastUpdated => 1104630516,
},
'default view description' => {
message => q|The default screen for this thing. This can be either the search screen or the add screen.|,
lastUpdated => 1104630516,
},
'display label' => {
message => q|Display|,
lastUpdated => 1104630516,
},
'view screen title label' => {
message => q|View Screen Title|,
lastUpdated => 1104630516,
},
'search screen title label' => {
message => q|Search Screen Title|,
lastUpdated => 1104630516,
},
'search screen title description' => {
message => q|The title of the search screen|,
lastUpdated => 1104630516,
},
'search descrpiption label' => {
message => q|Description|,
lastUpdated => 1104630516,
},
'search descrpiption description' => {
message => q|Description of the search screen.|,
lastUpdated => 1104630516,
},
'who can search label' => {
message => q|Who can search?|,
lastUpdated => 1104630516,
},
'who can search description' => {
message => q|The group that can search this thing.|,
lastUpdated => 1104630516,
},
'who can import label' => {
message => q|Who can import?|,
lastUpdated => 1104630516,
},
'who can import description' => {
message => q|The group that can import data into this thing.|,
lastUpdated => 1104630516,
},
'who can export label' => {
message => q|Who can export?|,
lastUpdated => 1104630516,
},
'who can export description' => {
message => q|The group that can export this things data.|,
lastUpdated => 1104630516,
},
'search button label' => {
message => q|Search|,
lastUpdated => 1104630516,
},
'search template label' => {
message => q|Search Template|,
lastUpdated => 1104630516,
},
'search template description' => {
message => q|This template is used to display the search screen of this thing.|,
lastUpdated => 1104630516,
},
'things per page label' => {
message => q|Things Per Page|,
lastUpdated => 1104630516,
},
'things per page description' => {
message => q|The number of things that the search screen displays per page.|,
lastUpdated => 1104630516,
},
'search in label' => {
message => q|Search|,
lastUpdated => 1104630516,
},
'sort by label' => {
message => q|Sort By|,
lastUpdated => 1104630516,
},
'export label' => {
message => q|Export|,
lastUpdated => 1104630516,
},
'import label' => {
message => q|Import|,
lastUpdated => 1104630516,
},
'import file label' => {
message => q|Choose a file to import|,
lastUpdated => 1104630516,
},
'duplicates label' => {
message => q|What about duplicates?|,
lastUpdated => 1104630516,
},
'ignore first line label' => {
message => q|Ignore first line?|,
lastUpdated => 1104630516,
},
'skip label' => {
message => q|Skip|,
lastUpdated => 1104630516,
},
'overwrite label' => {
message => q|Overwrite|,
lastUpdated => 1104630516,
},
'file contains label' => {
message => q|File Contains|,
lastUpdated => 1104630516,
},
'check duplicates label' => {
message => q|Check Duplicates|,
lastUpdated => 1104630516,
},
'field label label' => {
message => q|Label|,
lastUpdated => 1031514049
},
'field label description' => {
message => q|The label for this field.|,
lastUpdated => 1119156590,
},
'field type label' => {
message => q|Field Type|,
lastUpdated => 1031514049
},
'field type description' => {
message => q|Choose the type of form element for this field. This is also used to validate any input that the user may supply.|,
lastUpdated => 1119156590,
},
'default value label' => {
message => q|Default Value|,
lastUpdated => 1031514049
},
'default value description' => {
message => q|Enter the default value (if any) for the field. For Yes/No fields, enter "yes" to select "Yes" and "no" to select "No".|,
lastUpdated => 1119156590,
},
'subtext label' => {
message => q|Subtext|,
lastUpdated => 1031514049
},
'subtext description' => {
message => q|An extension of the label, this is additional information such as a description of what should go in the field or optional instructions for the field.|,
lastUpdated => 1133811301,
},
'fieldstatus hidden label' => {
message => q|Hidden|,
lastUpdated => 1031514049
},
'fieldstatus visible label' => {
message => q|Visible|,
lastUpdated => 1031514049
},
'fieldstatus editable label' => {
message => q|Editable|,
lastUpdated => 1031514049
},
'fieldstatus required label' => {
message => q|Required|,
lastUpdated => 1031514049
},
'field status label' => {
message => q|Status|,
lastUpdated => 1031514049
},
'field status description' => {
message => q|Hidden fields will not be visible to the user. Visible fields can be seen by the user but not modified. Editable fields can be filled in by the user. Required fields must be filled in by the user. If you choose Hidden or Visible, be sure to fill in a Default Value.|,
lastUpdated => 1119156590,
},
'width label' => {
message => q|Width|,
lastUpdated => 1104630516,
},
'width description' => {
message => q|Set the width of textareas and HTMLareas in pixels.|,
lastUpdated => 1104630516,
},
'size label' => {
message => q|Size|,
lastUpdated => 1104630516,
},
'size description' => {
message => q|Set the size(width) of most fields in characters.|,
lastUpdated => 1104630516,
},
'height label' => {
message => q|Height|,
lastUpdated => 1104630516,
},
'height description' => {
message => q|Set the height of this field in pixels. Only used on Textareas and HTMLAreas.|,
lastUpdated => 1153876588,
},
'height subtext' => {
message => q|Optional for text area and HTML area.|,
lastUpdated => 1104630516,
},
'vertical label' => {
message => q|Vertical|,
lastUpdated => 1104630516,
},
'vertical description' => {
message => q|This property controls whether radio buttons and checklists are laid out horizontally or
vertically.|,
lastUpdated => 1104630516,
},
'extras label' => {
message => q|Extras|,
lastUpdated => 1104630516,
},
'extras description' => {
message => q|Here you can enter additional tag properties for the field tag. For instance
'class="myClass"'.|,
lastUpdated => 1104630516,
},
'possible values label' => {
message => q|Possible values|,
lastUpdated => 1104630516,
},
'possible values description' => {
message => q|This field is used for the list types (like Checkbox List and Select List). Enter the values
you wish to appear, one per line.|,
lastUpdated => 1104630516,
},
'possible values subtext' => {
message => q|One per line.|,
lastUpdated => 1104630516,
},
'field in other thing label' => {
message => q|Field In Other Thing|,
lastUpdated => 1104630516,
},
'edit label' => {
message => q|Edit|,
lastUpdated => 1104630516,
},
'delete label' => {
message => q|Delete|,
lastUpdated => 1104630516,
},
'add label' => {
message => q|Add|,
lastUpdated => 1104630516,
},
'search label' => {
message => q|Search|,
lastUpdated => 1104630516,
},
'is required error' => {
message => q| is required|,
lastUpdated => 1104630516,
},
'thingy template label' => {
message => q|Thingy Template|,
lastUpdated => 1104630516,
},
'view thing template label' => {
message => q|Thingy View Thing Template|,
lastUpdated => 1104630516,
},
'edit thing template label' => {
message => q|Thingy Edit Thing Template|,
lastUpdated => 1104630516,
},
'search thing template label' => {
message => q|Thingy Search Thing Template|,
lastUpdated => 1104630516,
},
'canEditThings' => {
message => q|Is true if the current user can view the Things that are defined for this Thingy Asset|,
lastUpdated => 1104630516,
},
'things_loop' => {
message => q|A loop containing the Things that are defined for this Thingy Asset, with links to management
functions for those Things|,
lastUpdated => 1104630516,
},
'thing_editIcon' => {
message => q|An icon with a link to the edit screen for this Thing|,
lastUpdated => 1104630516,
},
'thing_editUrl' => {
message => q|A link to the edit screen for this Thing|,
lastUpdated => 1104630516,
},
'thing_viewIcon' => {
message => q|An icon with a link to default screen for this Thing|,
lastUpdated => 1104630516,
},
'thing_searchUrl' => {
message => q|A link to the search screen for this Thing|,
lastUpdated => 1104630516,
},
'thing_addUrl' => {
message => q|A link to the add screen for this Thing|,
lastUpdated => 1104630516,
},
'thing_deleteIcon' => {
message => q|An icon with a link to delete this Thing|,
lastUpdated => 1104630516,
},
'thing_deleteUrl' => {
message => q|A link to delete this Thing|,
lastUpdated => 1104630516,
},
'thing_label' => {
message => q|The label for this Thing|,
lastUpdated => 1104630516,
},
'thing_id' => {
message => q|The id of this Thing|,
lastUpdated => 1104630516,
},
'manage_url' => {
message => q|This Url will lead to a screen to manage the Things in this Thingy Asset.|,
lastUpdated => 1104630516,
},
'addThing_url' => {
message => q|This Url leads to the screen to add a new Thing to this Thingy Asset.|,
lastUpdated => 1104630516,
},
'delete_url' => {
message => q|The Url to delete the current thing|,
lastUpdated => 1104630516,
},
'delete_confirm' => {
message => q|This contains an onclick property for the delete link that adds a javascript confirmation|,
lastUpdated => 1104630516,
},
'search_url' => {
message => q|Url that leads to the search screen|,
lastUpdated => 1104630516,
},
'add_url' => {
message => q|Url to the add screen for this thing|,
lastUpdated => 1104630516,
},
'editScreenTitle' => {
message => q|The title for the edit screen|,
lastUpdated => 1104630516,
},
'editInstructions' => {
message => q|Instructions about editing this thing|,
lastUpdated => 1104630516,
},
'error_loop' => {
message => q|A loop containing error information, for instance if someone doesn't fill out a required
field.|,
lastUpdated => 1104630516,
},
'error_message' => {
message => q|An error message indicating what the user might have done wrong.|,
lastUpdated => 1104630516,
},
'field_loop' => {
message => q|A loop containing the visible fields for this thing|,
lastUpdated => 1104630516,
},
'field_isHidden' => {
message => q|A conditional indicating whether this field is supposed to be hidden.|,
lastUpdated => 1104630516,
},
'field_isRequired' => {
message => q|A conditional indicating whether this field is required.|,
lastUpdated => 1104630516,
},
'field_isDisplayed' => {
message => q|A conditional indicating whether this field is supposed to be displayed.|,
lastUpdated => 1104630516,
},
'field_form' => {
message => q|The form element for this field.|,
lastUpdated => 1104630516,
},
'field_name' => {
message => q|The name of the form element for this field|,
lastUpdated => 1104630516,
},
'field_label' => {
message => q|The label of this field|,
lastUpdated => 1104630516,
},
'field_url' => {
message => q|An optional url that this field should link to, used i.e. for fields in other things.|,
lastUpdated => 1104630516,
},
'field_value' => {
message => q|The value of this field|,
lastUpdated => 1104630516,
},
'field_subtext' => {
message => q|A description of the field so that users know what to put in the field.|,
lastUpdated => 1104630516,
},
'form_start' => {
message => q|The start tag of the form|,
lastUpdated => 1104630516,
},
'form_submit' => {
message => q|A form button to submit the form data.|,
lastUpdated => 1104630516,
},
'form_end' => {
message => q|The end of the form|,
lastUpdated => 1104630516,
},
'edit_url' => {
message => q|Url to the current things edit screen.|,
lastUpdated => 1104630516,
},
'viewScreenTitle' => {
message => q|The title for the view screen|,
lastUpdated => 1104630516,
},
'import_url' => {
message => q|Url to import data into this Thing from a csv file|,
lastUpdated => 1104630516,
},
'export_url' => {
message => q|Url to export the data in a search result into a csv file. This is only available after a
search has been done.|,
lastUpdated => 1104630516,
},
'searchScreenTitle' => {
message => q|The title of the search screen|,
lastUpdated => 1104630516,
},
'searchDescription' => {
message => q|A description of the search screen.|,
lastUpdated => 1104630516,
},
'searchFields_loop' => {
message => q|A loop that contains the fields that are searchable|,
lastUpdated => 1104630516,
},
'searchFields_label' => {
message => q|The label of a searchable field.|,
lastUpdated => 1104630516,
},
'searchFields_fieldId' => {
message => q|The fieldId of a searchable field.|,
lastUpdated => 1104630516,
},
'searchFields_form' => {
message => q|The form element to search this field.|,
lastUpdated => 1104630516,
},
'displayInSearchFields_loop' => {
message => q|A loop containing the fields that are displayed in the search results.|,
lastUpdated => 1104630516,
},
'displayInSearchFields_orderByUrl' => {
message => q|Url to order the search results by this field.|,
lastUpdated => 1104630516,
},
'displayInSearchFields_label' => {
message => q|The label of this field.|,
lastUpdated => 1104630516,
},
'displayInSearchFields_fieldId' => {
message => q|The fieldId of this field.|,
lastUpdated => 1104630516,
},
'searchResult_loop' => {
message => q|A loop containting the search results.|,
lastUpdated => 1104630516,
},
'searchResult_id' => {
message => q|The id of a search result.|,
lastUpdated => 1104630516,
},
'searchResult_view_url' => {
message => q|Url to the view screen of this search result|,
lastUpdated => 1104630516,
},
'searchResult_edit_icon' => {
message => q|Edit icon that links to the edit screen of this search result.|,
lastUpdated => 1104630516,
},
'searchResult_delete_icon' => {
message => q|Delete icon to delete this search result.|,
lastUpdated => 1104630516,
},
'searchResult_field_loop' => {
message => q|A loop containing the fields that are to be displayed for this search result.|,
lastUpdated => 1104630516,
},
'field_id' => {
message => q|The id of this field.|,
lastUpdated => 1104630516,
},
'no field values message' => {
message => q|Field does not have any values.|,
lastUpdated => 1104630516,
},
'' => {
message => q||,
lastUpdated => 1104630516,
},
};
1;

115
t/Asset/Wobject/Thingy.t Normal file
View file

@ -0,0 +1,115 @@
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use FindBin;
use strict;
use lib "$FindBin::Bin/../../lib";
##The goal of this test is to test the creation of Thingy Wobjects.
use WebGUI::Test;
use WebGUI::Session;
use WebGUI::PseudoRequest;
use Test::More tests => 7; # increment this value for each test you create
use WebGUI::Asset::Wobject::Thingy;
my $session = WebGUI::Test->session;
# Do our work in the import node
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Thingy Test"});
my $thingy = $node->addChild({className=>'WebGUI::Asset::Wobject::Thingy'});
# Test for a sane object type
isa_ok($thingy, 'WebGUI::Asset::Wobject::Thingy');
# Test to see if we can set new values
my $newThingySettings = {
templateId=>'testingtestingtesting1',
#searchRoot=>'testingtestingtesting2',
#classLimiter=>'WebGUI::Asset::Wobject::Article',
};
$thingy->update($newThingySettings);
foreach my $newSetting (keys %{$newThingySettings}) {
is ($thingy->get($newSetting), $newThingySettings->{$newSetting}, "updated $newSetting is ".$newThingySettings->{$newSetting});
}
# Test adding a new Thing
my $i18n = WebGUI::International->new($session, "Asset_Thingy");
my $groupIdEdit = $thingy->get("groupIdEdit");
my %thingProperties = (
thingId=>"new",
label=>$i18n->get('assetName'),
editScreenTitle=>$i18n->get('edit screen title label'),
groupIdAdd=>$groupIdEdit,
groupIdEdit=>$groupIdEdit,
saveButtonLabel=>$i18n->get('default save button label'),
afterSave=>'searchThisThing',
editTemplateId=>"ThingyTmpl000000000003",
groupIdView=>$groupIdEdit,
viewTemplateId=>"ThingyTmpl000000000002",
defaultView=>'searchThing',
searchScreenTitle=>$i18n->get('search screen title label'),
groupIdSearch=>$groupIdEdit,
groupIdExport=>$groupIdEdit,
groupIdImport=>$groupIdEdit,
searchTemplateId=>"ThingyTmpl000000000004",
thingsPerPage=>25,
);
my $thingId = $thingy->addThing(\%thingProperties,0);
my $isValidId = $session->id->valid($thingId);
is($isValidId,1,"addThing returned a valid id: ".$thingId);
my $thingTableName = "Thingy_".$thingId;
my ($thingTableNameCheck) = $session->db->quickArray("show tables like ".$session->db->quote($thingTableName));
is($thingTableNameCheck,$thingTableName,"An empty table: ".$thingTableName." for the new thing exists.");
my %fieldProperties = (
thingId=>$thingId,
fieldId=>"new",
label=>$i18n->get('assetName')." field",
dateCreated=>time(),
fieldType=>"textarea",
status=>"editable",
);
my $fieldId = $thingy->addField(\%fieldProperties,0);
$isValidId = $session->id->valid($fieldId);
is($isValidId,1,"Adding a textarea field: addField returned a valid id: ".$fieldId);
my ($fieldLabel, $columnType, $Null, $Key, $Default, $Extra) = $session->db->quickArray("show columns from "
.$session->db->dbh->quote_identifier($thingTableName)
." like ".$session->db->quote("Field_".$fieldId));
is($fieldLabel,"field_".$fieldId,"A column for the new field Field_$fieldId exists.");
is($columnType,"longtext","The columns is the right type");
=cut
my $request = WebGUI::PseudoRequest->new();
$session->{_request} = $request;
$session->request->uri($thingy->get("url"));
$request->setup_body({ param1 => 'value1' });
=cut
END {
# Clean up after thy self
$versionTag->rollback();
}

View file

@ -0,0 +1,36 @@
/*div.workarea { padding:10px; float:left }*/
ul.draglist {
/*position: relative;*/
width: 600px;
background: #f7f7f7;
/*border: 1px solid gray;*/
list-style: none;
margin:0;
padding:0;
}
ul.draglist li {
margin: 1px;
cursor: move;
}
ul.draglist_alt li {
margin: 1px;
cursor: move;
}
li.list1 {
/*background-color: #D1E6EC;*/
border:1px solid #7EA6B2;
}
#dialog1{
height: 400px;
}
#dialog2{
height: 400px;
}

View file

@ -0,0 +1,523 @@
function initOptionalFields(prefix,fieldId) {
var fieldInThing_module_rendered;
var height_module = new YAHOO.widget.Module(prefix + "_height_module", { visible: false });
height_module.render();
var width_module = new YAHOO.widget.Module(prefix + "_width_module", { visible: false });
width_module.render();
var size_module = new YAHOO.widget.Module(prefix + "_size_module", { visible: false });
size_module.render();
var vertical_module = new YAHOO.widget.Module(prefix + "_vertical_module", { visible: false });
vertical_module.render();
var values_module = new YAHOO.widget.Module(prefix + "_values_module", { visible: false });
values_module.render();
var defaultValue_module = new YAHOO.widget.Module(prefix + "_defaultValue_module", { visible: false });
defaultValue_module.render();
var fieldInThing_module = new YAHOO.widget.Module(prefix + "_fieldInThing_module", { visible: false });
fieldInThing_module.render();
var defaultFieldInThing_module = new YAHOO.widget.Module(prefix + "_defaultFieldInThing_module", { visible: false });
defaultFieldInThing_module.render();
YAHOO.util.Event.onContentReady(prefix+"_fieldType_formId", checkFieldType);
YAHOO.util.Event.addListener(prefix+"_fieldType_formId", "change", checkFieldType);
function checkFieldType(){
if (this.value == "HTMLArea" || this.value == "textarea"){
height_module.show();
width_module.show()
}else{
height_module.hide();
width_module.hide()
}
if (this.value == "radioList" || this.value == "checkList"){
vertical_module.show();
}else{
vertical_module.hide();
}
if (this.value == "HTMLArea" || this.value == "textarea" || this.value == "radioList" || this.value == "checkList" || this.value == "zipcode"){
size_module.hide()
}else{
size_module.show();
}
if (this.value == "selectList" || this.value == "selectBox" || this.value == "radioList" || this.value == "checkList"){
values_module.show();
}else{
values_module.hide();
}
var valueStart = this.value.slice(0,10);
if(valueStart == "otherThing" || this.value == "file"){
defaultValue_module.hide();
}else{
defaultValue_module.show();
}
if(valueStart == "otherThing"){
var thingId = this.value.slice(11);
var getFieldValues = function() {
var fieldInOtherThingId = this.value;
var url = location.pathname + "?func=selectDefaultFieldValue;thingId=" + thingId + ";fieldInOtherThingId=" + fieldInOtherThingId + ";fieldId=" + fieldId;
var handleSuccess = function(o){
defaultFieldInThing_module.setBody(o.responseText);
defaultFieldInThing_module.show();
};
var handleFailure = function(o) {
alert("Get field values failed: " + o.status);
};
var callback =
{
success:handleSuccess,
failure:handleFailure
};
var request = YAHOO.util.Connect.asyncRequest('GET', url, callback);
};
if (fieldInThing_module_rendered == thingId){
fieldInThing_module.show();
}else{
var url = location.pathname + "?func=selectFieldInThing;thingId=" + thingId + ";prefix=" +prefix + ";fieldId=" + fieldId;
var handleSuccess = function(o){
fieldInThing_module.setBody(o.responseText);
fieldInThing_module.show();
fieldInThing_module_rendered = thingId;
YAHOO.util.Event.onContentReady(prefix+"_fieldInOtherThing_formId",getFieldValues);
YAHOO.util.Event.addListener(prefix+"_fieldInOtherThing_formId","change", getFieldValues);
};
var handleFailure = function(o) {
alert("Get fields in thing failed: " + o.status);
};
var callback =
{
success:handleSuccess,
failure:handleFailure
};
var request = YAHOO.util.Connect.asyncRequest('GET', url, callback);
}
}else{
fieldInThing_module.hide();
defaultFieldInThing_module.hide();
}
}
}
function editListItem(url,fieldId) {
var handleGetFormSuccess = function(o){
var handleSuccess = function(o) {
var response = o.responseText;
var listItemId = response.slice(0,22);
var newInnerHTML = response.slice(22);
var label = editFieldDialog.getData().label;
var li = new YAHOO.util.Element(listItemId);
li.set('innerHTML',newInnerHTML);
var search_label = new YAHOO.util.Element("search_label_"+listItemId);
search_label.set('innerHTML',label);
var view_label = new YAHOO.util.Element("view_label_"+listItemId);
view_label.set('innerHTML',label);
};
var handleFailure = function(o) {
alert("Submission failed: " + o.status);
};
var handleSubmit = function() {
this.submit();
};
var handleCancel = function() {
this.cancel();
this.destroy();
};
function optionalFields() {
initOptionalFields("edit_"+fieldId+"_Dialog",fieldId);
}
editFieldDialog = new YAHOO.widget.Dialog("dialog2", { width:"460px", visible:false, draggable:true, close:true, fixedcenter:true, zIndex:11001,
buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
{ text:"Cancel", handler:handleCancel } ]
} );
editFieldDialog.setHeader("Edit Field");
editFieldDialog.setBody(o.responseText);
editFieldDialog.render(document.body);
editFieldDialog.callback = { success: handleSuccess, failure: handleFailure };
editFieldDialog.show();
YAHOO.util.Event.onContentReady("dialog2", optionalFields);
};
var handleGetFormFailure = function(o) {
alert("Getting edit field dialog failed: " + o.status);
};
var callbackGetForm =
{
success:handleGetFormSuccess,
failure:handleGetFormFailure,
cache:false
};
var request = YAHOO.util.Connect.asyncRequest('GET', url, callbackGetForm);
}
function initAddFieldDialog() {
var handleSuccess = function(o) {
var response = o.responseText;
var listItemId = response.slice(0,22);
var newInnerHTML = response.slice(22);
var label = addFieldDialog.getData().label;
var ul1 = new YAHOO.util.Element('ul1');
var li = document.createElement('li');
li.id = listItemId;
li.className = 'list1';
li.innerHTML = newInnerHTML;
ul1.appendChild(li);
var newListItem = Dom.get(listItemId);
new YAHOO.draglist.DDList(newListItem);
// Add table row to fields on search tab
var search_fields_table = new YAHOO.util.Element('search_fields_table');
var search_tr = document.createElement('tr');
search_tr.id = "search_tr_"+listItemId;
search_fields_table.appendChild(search_tr);
var label_td = document.createElement('td');
label_td.id = "search_label_"+listItemId;
label_td.className = 'formDescription';
label_td.innerHTML = label;
search_tr.appendChild(label_td);
var displayInSearch_td = document.createElement('td');
displayInSearch_td.id = "search_label_"+listItemId;
displayInSearch_td.className = 'tableData';
displayInSearch_td.innerHTML = "<input type='checkbox' name='displayInSearch_"+listItemId+"' value='1' checked='checked' />";
search_tr.appendChild(displayInSearch_td);
var searchIn_td = document.createElement('td');
searchIn_td.id = "search_label_"+listItemId;
searchIn_td.className = 'tableData';
searchIn_td.innerHTML = "<input type='checkbox' name='searchIn_"+listItemId+"' value='1' />";
search_tr.appendChild(searchIn_td);
var sortBy_td = document.createElement('td');
sortBy_td.id = "search_label_"+listItemId;
sortBy_td.className = 'tableData';
sortBy_td.innerHTML = "<input type='radio' name='sortBy' value='"+listItemId+"' />";
search_tr.appendChild(sortBy_td);
// Add table row to fields on view tab
var view_fields_table = new YAHOO.util.Element('view_fields_table');
var view_fields_table_rows = view_fields_table.getElementsByTagName("tr");
var view_tr = document.createElement('tr');
view_tr.id = "view_tr_"+listItemId;
view_fields_table.appendChild(view_tr);
var view_label_td = document.createElement('td');
view_label_td.id = "view_label_"+listItemId;
view_label_td.className = 'formDescription';
view_label_td.innerHTML = label;
view_tr.appendChild(view_label_td);
var display_td = document.createElement('td');
display_td.id = "search_label_"+listItemId;
display_td.className = 'tableData';
display_td.innerHTML = "<input type='checkbox' name='display_"+listItemId+"' value='1' checked='checked' />";
view_tr.appendChild(display_td);
var viewScreenTitle_td = document.createElement('td');
viewScreenTitle_td.id = "search_label_"+listItemId;
viewScreenTitle_td.className = 'tableData';
// only the first field should be checked by default
if (view_fields_table_rows.length == 2){
viewScreenTitle_td.innerHTML = "<input type='checkbox' name='viewScreenTitle_"+listItemId+"' value='1' checked='checked'/>";
}else{
viewScreenTitle_td.innerHTML = "<input type='checkbox' name='viewScreenTitle_"+listItemId+"' value='1' />";
}
view_tr.appendChild(viewScreenTitle_td);
};
var handleFailure = function(o) {
alert("Submission failed: " + o.status);
};
var handleSubmit = function() {
this.submit();
};
var handleCancel = function() {
this.cancel();
};
var addFieldDialog = new YAHOO.widget.Dialog("dialog1", { width:"460px", visible:false,
draggable:true, close:true, fixedcenter:true, zIndex:11002,
buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
{ text:"Cancel", handler:handleCancel } ]
} );
addFieldDialog.callback = { success: handleSuccess, failure: handleFailure };
addFieldDialog.render();
initOptionalFields("addDialog");
YAHOO.util.Event.addListener("showAddFormButton", "click", addFieldDialog.show, addFieldDialog, true);
}
YAHOO.util.Event.addListener(window, "load", initAddFieldDialog);
function deleteListItem (url,listItemId,thingId) {
if (confirm("Are you sure you want to delete this field?")){
var handleSuccess = function(o){
var ul1 = new YAHOO.util.Element('ul1');
var removeElement = YAHOO.util.Dom.get(listItemId);
ul1.removeChild(removeElement);
var search_fields_table = new YAHOO.util.Element('search_fields_table');
removeElement = YAHOO.util.Dom.get("search_tr_"+listItemId);
search_fields_table.removeChild(removeElement);
var view_fields_table = new YAHOO.util.Element('view_fields_table');
removeElement = YAHOO.util.Dom.get("view_tr_"+listItemId);
view_fields_table.removeChild(removeElement);
};
var handleFailure = function(o) {
alert("Submission failed: " + o.status);
};
var callback =
{
success:handleSuccess,
failure:handleFailure
};
var postData = "func=deleteFieldConfirm;fieldId=" + listItemId + ";thingId=" + thingId;
var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, postData);
}
}
var Dom = YAHOO.util.Dom;
var Event = YAHOO.util.Event;
var DDM = YAHOO.util.DragDropMgr;
YAHOO.namespace ("draglist");
(function() {
YAHOO.draglist.DDApp = {
init: function() {
new YAHOO.util.DDTarget("ul1");
var ul1=Dom.get("ul1");
var items = ul1.getElementsByTagName("li");
for (i=0;i<items.length;i=i+1) {
new YAHOO.draglist.DDList(items[i].id);
}
}
};
YAHOO.draglist.DDList = function(id, sGroup, config) {
YAHOO.draglist.DDList.superclass.constructor.call(this, id, sGroup, config);
this.logger = this.logger || YAHOO;
var el = this.getDragEl();
Dom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent
this.setXConstraint(0,0);
this.goingUp = false;
this.lastY = 0;
};
var getRank = function(ul,curId) {
var items = ul.getElementsByTagName("li");
var rank;
for (i=0;i<items.length;i=i+1) {
if(items[i].id == curId){
rank = i;
}
}
return rank;
};
var destination = "";
var direction = "";
var origRank = "";
YAHOO.extend(YAHOO.draglist.DDList, YAHOO.util.DDProxy, {
startDrag: function(x, y) {
this.logger.log(this.id + " startDrag");
// make the proxy look like the source element
var dragEl = this.getDragEl();
var clickEl = this.getEl();
origRank = getRank(clickEl.parentNode,clickEl.id);
Dom.setStyle(clickEl, "opacity", 0.20);
dragEl.innerHTML = clickEl.innerHTML;
Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
Dom.setStyle(dragEl, "border", "2px solid gray");
},
endDrag: function(e) {
var srcEl = this.getEl();
var proxy = this.getDragEl();
var doAnimation = function (){
Dom.setStyle(proxy, "visibility", "");
var a = new YAHOO.util.Motion(
proxy, {
points: {
to: Dom.getXY(srcEl)
}
},
0.2,
YAHOO.util.Easing.easeOut
)
var proxyid = proxy.id;
var thisid = srcEl.id;
// Hide the proxy and show the source element when finished with the animation
a.onComplete.subscribe(function() {
Dom.setStyle(proxyid, "visibility", "hidden");
//Dom.setStyle(thisid, "visibility", "");
Dom.setStyle(thisid, "opacity", 1);
});
a.animate();
}
var curRank = getRank(srcEl.parentNode,srcEl.id);
if (destination == "" || origRank == curRank){
doAnimation();
}
else{
var handleSuccess = function(o){
// Show the proxy element and animate it to the src element's location
if (o.responseText == "fieldMoved"){
doAnimation();
}else{
alert('wrong response from moveFieldConfirm : ' + o.responseText);
}
};
var handleFailure = function(o) {
alert("Submission failed: " + o.status);
};
var callback =
{
success:handleSuccess,
failure:handleFailure
};
var url = location.pathname;
//curRank = curRank +1;
//origRank = origRank +1;
var postData = "func=moveFieldConfirm;fieldId=" + srcEl.id + ";targetFieldId=" + destination+";direction="+direction;//currentRank="+curRank+";originalRank="+origRank+";
var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, postData);
}
},
onDragDrop: function(e, id) {
// If there is one drop interaction, the li was dropped either on the list,
// or it was dropped on the current location of the source element.
if (DDM.interactionInfo.drop.length === 1) {
// The position of the cursor at the time of the drop (YAHOO.util.Point)
var pt = DDM.interactionInfo.point;
// The region occupied by the source element at the time of the drop
var region = DDM.interactionInfo.sourceRegion;
// Check to see if we are over the source element's location. We will
// append to the bottom of the list once we are sure it was a drop in
// the negative space (the area of the list without any list items)
if (!region.intersect(pt)) {
var destEl = Dom.get(id);
var destDD = DDM.getDDById(id);
destEl.appendChild(this.getEl());
destDD.isEmpty = false;
DDM.refreshCache();
}
}
},
onDrag: function(e) {
// Keep track of the direction of the drag for use during onDragOver
var y = Event.getPageY(e);
if (y < this.lastY) {
this.goingUp = true;
} else if (y > this.lastY) {
this.goingUp = false;
}
this.lastY = y;
},
onDragOver: function(e, id) {
var srcEl = this.getEl();
var destEl = Dom.get(id);
// We are only concerned with list items, we ignore the dragover
// notifications for the list.
if (destEl.nodeName.toLowerCase() == "li") {
var orig_p = srcEl.parentNode;
var p = destEl.parentNode;
destination = destEl.id;
if (this.goingUp) {
direction = 'up';
p.insertBefore(srcEl, destEl); // insert above
} else {
direction = 'down';
p.insertBefore(srcEl, destEl.nextSibling); // insert below
}
DDM.refreshCache();
}
}
});
Event.onDOMReady(YAHOO.draglist.DDApp.init, YAHOO.draglist.DDApp, true);
})();