/FBCOM_WCM/testing/default/main/www/????/???/WORKAREA/WA/templatedata/???_??/?????/presentation/activity_list.tpl
Smarty Template | 225 lines | 189 code | 36 blank | 0 comment | 16 complexity | 2efd866e6d53c1753703c28a1720775d MD5 | raw file
- <?xml version="1.0" encoding="UTF-8"?>
- <iw_pt>
- <iw_perl><![CDATA[
-
- use TeamSite::Config;
- use Custom::Uti;
- use File::stat;
- use TeamSite::XMLparser;
-
- my $iwhome = TeamSite::Config::iwgethome();
- #log????
- my $isDebug = 1;
- my $debug_output = Custom::Uti::getLogPath("pt.log");
-
- my $dcr_name = iwpt_dcr_value('dcr.root.dcr-name');
-
- #more??,??
- #my $moreLink = "$dcr_name" . "_more.htm";
- my $moreLink = "http://www.fubon.com/bank/creditcard/inst_discount/inst_discount.htm?show=m2";
-
- #??????(11->??????,12->?????,13->????,14->????)
- my $messageType = iwpt_dcr_value('dcr.root.type');
- my $messageTitle = "?????";
- my $messageTitleClass = "other-info right";
-
- #????
- my $messageLimit = 2;
-
-
- # ????
- my @allOtherActivity = iwpt_dcr_list('dcr.root.otherActivity');
- my $allOtherActivity = @allOtherActivity;
- my $allOtherActivity_detail = "";
- # ???????? Modify By Gasper.Huang 20101110
- my $pic = iwpt_dcr_value('dcr.root.picContent');
- $pic =~ s/^\/htdocs\/.*\/$dcr_name\//\.\/$dcr_name\//;
-
-
- if ($allOtherActivity eq "0") {
- $allOtherActivity_detail = "";
- } else {
- for ( my $i = 0; $i < $allOtherActivity; $i++ ) {
- # ????????,?????
- my $publishDate = iwpt_dcr_value('dcr.root.otherActivity[$i].publish-date');
- my $endDate = iwpt_dcr_value('dcr.root.otherActivity[$i].off-date');
- unless($publishDate){$publishDate = Custom::Uti::getToday()};
- unless($endDate){$endDate = "21071231"};
- my $today = Custom::Uti::getToday();
- if($publishDate <= $today && $endDate >= $today){
- if( $i < $messageLimit){
- my $title = iwpt_dcr_value('dcr.root.otherActivity[$i].title');
- my $url = iwpt_dcr_value('dcr.root.otherActivity[$i].url');
- # ????????
- my $urlTarget = iwpt_dcr_value('dcr.root.otherActivity[$i].urlTarget');
- $urlTarget = ($urlTarget eq "_01") ? "" : " target=\"_blank\"";
- $allOtherActivity_detail .= "<li><a href=\"$url\"$urlTarget>$title</a></li>\n";
- }
- }
- else{
- $messageLimit++;
- }
- }
- }
-
- #??more????
- &genMore1;
-
- #&insertDB;
-
-
- #============================================================================
- # ????(UTF8?????????)
- # arg1:pt??????
- # arg2:dcr??????
- # arg3:??????????
- #============================================================================
- sub genHtml {
- my ( $pt, $dcr, $output ,$args ) = @_;
- my $param = $args ? "-iw_pt-arg $args" : "";
- my $autoGenCMD = toBig5("$iwhome/iw-perl/bin/iwperl $iwhome/bin/iwpt_compile.ipl -osenc cp950 -pt $pt -iw_pt-dcr $dcr -ofile $output $param 2>&1") ;
- debug("iwgen CMD = $autoGenCMD");
- my $autoGenRC = `$autoGenCMD`;
- debug("iwgen RETURN = $autoGenRC");
- $output = toBig5($output);
-
- if ( $autoGenRC =~ /could not create/
- || $autoGenRC =~ /does not/
- || !-e $output )
- {
- return 0;
- }
- return 1;
- }
-
- #============================================================================
- # ??more???
- #============================================================================
-
- sub genMore1{
-
- my $dcrPath = iwpt_dcr_value('dcr.root.dcr-path');
- $dcrPath =~ s|\/|\\|g;
- my $saveName = "htdocs\\bank\\creditcard\\home\\$dcr_name" . "_more.htm";
- my $ptName = "creditcard_more1.tpl";
- my $ptPath = $dcrPath;
- my $genPath = $dcrPath;
- $ptPath =~ s|\\data\\.*|\\presentation\\$ptName|gi;
- $genPath =~ s|\\templatedata\\.*|\\$saveName|gi;
- $isGenSuccess = genHtml( $ptPath, $dcrPath, $genPath );
-
- if ($isGenSuccess) {
- debug("GENERATE PAGE SUCCESS:" . toBig5($genPath) );
- }
- else {
- debug("GENERATE PAGE FAIL:" . toBig5($genPath) );
- }
- }
-
-
-
- sub insertDB{
- my $rootNodes = getXmlRootnode( toBig5(iwpt_dcr_value('dcr.root.dcr-path')) );
-
- my $type = $rootNodes->value('type');
- my $delSql = "delete from ts_publish_page where type='$type'";
- my @sqlAry = ($delSql);
-
- my $today = Custom::Uti::getToday();
- my @alist = $rootNodes->get_node_list('otherActivity');
- my $i = 1;
- foreach my $rec (@alist){
- my $title = $rec->get_node('title')->value();
- my $linkUrl = $rec->get_node('url')->value();
- my $publishDate = $rec->get_node('publish-date')->value();
- my $endDate = $rec->get_node('off-date')->value();
- my $id = $rec->get_node('pk')->value();
- $linkUrl =~ s/^\/htdocs\/.*\/$dcr_name\//\.\/$dcr_name\//;
- # my $linkUrl = "http://10.204.241.15/bank/rich/home/$dcr_name.htm";
- # ????????,?????
- unless($publishDate){$publishDate = Custom::Uti::getToday()};
- unless($endDate){$endDate = "21071231"};
-
- debug("title:$title");
- debug("url:$linkUrl");
- debug("publishDate:$publishDate");
- debug("endDate:$endDate");
- debug("pk:" . toBig5($id));
-
- $sql = qq{
- insert into ts_publish_page (id,title,link_url,type,publish_date,ending_date,modify_date,put_home,orders)
- values('$id','$title','$linkUrl','$type','$publishDate','$endDate','$today','y',$i)
- };
- $sql = toBig5($sql);
- push @sqlAry , $sql;
- $i++;
- }
- use Custom::Dao;
- my $section = "wcm_datasource";
- my $isInsertSuccess = Custom::Dao::processTransaction($section,\@sqlAry);
- if($isInsertSuccess){
- debug ("INSERT DB SUCCESSFULLY\n");
- }
- else{
- debug("INSERT FAIL\n");
- }
-
- }
-
- sub getXmlRootnode {
- my ($dcr) = @_;
- debug("FILE NOT FOUND -->$dcr") if ( !-e $dcr );
- open( DCR, $dcr ) or debug("$! - Cannot open DCR ($dcr)");
- local $/ = undef;
- my $xml = <DCR>;
- close DCR;
- use TeamSite::XMLparser;
- my $parser = TeamSite::XMLparser->new();
- my $rootnode = $parser->parse($xml);
- return $rootnode;
- }
-
- sub toUTF8 {
- my ($in) = @_;
- my $out = TeamSite::I18N_utils::utf8_normalize_string( "Big5", $in );
- return $out;
- }
-
- sub toBig5 {
- my ($in) = @_;
- my $out = TeamSite::I18N_utils::utf8_to_other_encoding( "Big5", $in );
- return $out;
- }
-
- sub debug {
- if ( $debug_output && $isDebug ) {
- my $t = scalar localtime;
- open( OUT, ">> $debug_output" ) || return;
- print OUT "$t @_\n";
- close OUT;
- }
- }
-
- ]]></iw_perl>
- <![CDATA[
-
- <link href="../../../css/base.css" rel="stylesheet" type="text/css" media="screen">
- <link href="../../../css/bank/channel-creditcard.css" rel="stylesheet" type="text/css" media="screen">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-
- <div class="<iw_value name='$messageTitleClass'/>">
- <div class="title-other-info">
- <h1><iw_value name='$messageTitle'/></h1>
- <span class="more">| <a href="<iw_value name='$moreLink'/>">more</a></span>
- </div>
-
- <!--???????? Modify By Gasper.Huang 20101110-->
- <!--<img src="../../../images/bank/pic-other-info-2.jpg" width="240" height="80">-->
- <img src="<iw_value name='$pic'/>" width="240" height="80">
- <ul>
- <iw_value name='$allOtherActivity_detail'/>
- </ul>
- </div>
-
- ]]>
- </iw_pt>