####################################################### # # InfoHTMLGenerate - Generates HTML code of the info field # for the given product reference # # Arguments: 0 - reference of the product (HTML generated for) # 1 - item index (equal to prod ref on product page) # 2 - string value of the content # 3 - static/editable indicator # 4 - higlight? # # Returns: 0 - the generated HTML source # ####################################################### sub InfoHTMLGenerate { my $sProdref = shift; # the reference of the product my $nIndex = shift; # index of the field my $sValue = shift; # the initial value of the info (as standard string) my $bStatic = shift; # static or editable HTML? my $bHighLight = shift; my $sHTML; # the HTML code of the related edit box # # The default processing doesn't depend on the product reference # If you want product specific prodessing the edit the line # below as appropriate # if ($bStatic) { $sHTML = $sValue; } else { my $sStyle; if (defined $bHighLight && $bHighLight == $::TRUE) { $sStyle = " style=\"background-color: $::g_sErrorColor\""; } my $sIndex = "O_$nIndex"; $sHTML = ACTINIC::GetPhrase(-1, 2161, "", $sIndex, 35, 1000, $sValue, $sStyle); } ############################################################# # # CUSTOMISATION BEGIN # ############################################################# # # Alternate processing: # If you would like two info prompt fields for a given product # then your custom code should look like: if ($sProdref eq "GW") { my @aValues = split /\|\|\|/, $sValue; if ($bStatic) { $sHTML = join "
", @aValues; } else { $sHTML = "
"; $sHTML .= ""; } } # Note: the functions below should also reflect your customisation # ############################################################# # # CUSTOMISATION END # ############################################################# return $sHTML; } ####################################################### # # InfoHTMLGenerate - Generates HTML code of the info field # for the given product reference # # Arguments: 0 - reference of the product # 1 - item index (equal to prod ref on product page) # # Returns: 0 - the string value of the info prompt # ####################################################### sub InfoGetValue { my $sProdref = shift; # the reference of the product my $nIndex = shift; # index of the field my $sValue; # # The default processing doesn't depend on the product reference # If you want product specific prodessing the edit the line # below as appropriate # $sValue = $::g_InputHash{"O_$nIndex"}; $sValue =~ s/^\s+//; $sValue =~ s/\s+$//; ############################################################# # # CUSTOMISATION BEGIN # ############################################################# # Alternate processing: # If you would like two info prompt fields for a given product # then your custom code should look like: if ($sProdref eq "GW") { $sValue = $::g_InputHash{"O_1_$nIndex"}; $sValue .= "|||" . $::g_InputHash{"O_2_$nIndex"}; } ############################################################# # # CUSTOMISATION END # ############################################################# $sValue =~ s/\n/%0a/g; # Preserve new lines return $sValue; } ####################################################### # # InfoValidate - Validate the info prompt # for the given product reference # # Arguments: 0 - reference of the product # 1 - value of the field # # Returns: 0 - the validation result # 1 - error message if any # ####################################################### sub InfoValidate { my $sProdref = shift; # the reference of the product my $sInfo = shift; # the value of the field my $sPrompt = shift; # the prompt for the field my $sMessage; # # The default processing doesn't depend on the product reference # If you want product specific prodessing the edit the line # below as appropriate # if (length $sInfo == 0) # if there is no info, reprompt { $sMessage .= ACTINIC::GetPhrase(-1, 55, "$sPrompt") . "

\n"; } elsif (length $sInfo > 1000) { $sMessage .= ACTINIC::GetPhrase(-1, 56, "$sPrompt") . "

\n"; } ############################################################# # # CUSTOMISATION BEGIN # ############################################################# # Alternate processing: # If you have two info prompt fields and both of them should # be at least 5 chars long then your custom code should look # like: # # my @aValues = split /\|\|\|/, $sInfo; # if (length $aValues[0] < 5 || # length $aValues[1] < 5) # { # $sMessage = "The prompt should be at least 5 charaters long"; # } ############################################################# # # CUSTOMISATION END # ############################################################# return (length $sMessage == 0 ? $::SUCCESS : $::BADDATA, $sMessage); } ############################################################################################################## # # Other info prompt related processing - END # ##############################################################################################################