text:
<?php
/**
 *  This file is part of amfPHP
 *
 * LICENSE
 *
 * This source file is subject to the license that is bundled
 * with this package in the file license.txt.
 * @package Amfphp_BackOffice
 */
/**
 * includes
 */
require_once(dirname(__FILE__) . '/ClassLoader.php');
$accessManager = new Amfphp_BackOffice_AccessManager();
$isAccessGranted = $accessManager->isAccessGranted();
$config = new Amfphp_BackOffice_Config();
?>

    <title>Amfphp Back Office - Service Browser</title>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
        <link rel="stylesheet" type="text/css" href="css/jquery-ui.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />

            <?php
            require_once(dirname(__FILE__) . '/Header.inc.php');
            ?>

                            <?php
                            if (!$isAccessGranted) {
                                ?>

                                <?php
                                return;
                            }
                            ?>

Services and Methods

                                    Loading Service Data...

Method Caller

1. Select an Amfphp Service Method From the list on the left.
                                - Hide Description

2. Set your call parameters.

                            If you need to send a complex parameter, you can use JSON notation.
                            If you want the parameter value to be prefilled, you can propose an example value in your service comments.
                            See the documentation here.

                                This method has no parameters.

3. Call the server.

                                        Simple
                                        Advanced
                                        Call Repeater

                                        <input  type="submit" value="Call" onclick="makeJsonCall()"/>

                                            <input  type="submit" value="Call JSON" onclick="makeJsonCall()"/>
                                            <input  type="submit" value="Call AMF" onclick="makeAmfCall()"/>

                                            <input  type="submit" id="toggleRepeatBtn" value="Start Repeat Call AMF" onclick="toggleRepeat()"/>
                                            Number of Concurrent Calls
                                            <input id="concurrencyInput" value="1"/>

                                    Flash Player is needed to make AMF calls.

4. View the server's answer.

                                    Tree
                                    print_r
                                    JSON
                                    PHP Serialized
                                    Raw

        <?php
        require_once(dirname(__FILE__) . '/Footer.inc.php');
        ?>


text:
code: true
type: page
title: userMappings
description: BackendImport.userMappings method
---

# `userMappings()`

<SinceBadge version="2.14.0" />

Loads user mappings into the app.

This method is idempotent. If mappings are defined multiple times, only their last definition will be retained.

::: info
This method can only be used before the application is started.
:::

```ts
userMappings(mappings: JSONObject): void
```

| Argument | Type                  | Description                   |
|----------|-----------------------|-------------------------------|
| `mappings`  |
JSONObject
 | [User mappings](/core/2/guides/main-concepts/permissions#users). |

## Usage

```js
app.import.userMappings({
  properties: {
    fieldA: { type: 'keyword' },
    fieldB: { type: 'integer' }
  }
})
```

redpajama_set_name: RedPajamaGithub


text:
Titanium.UI.setBackgroundColor('#000');

// create tab group

var Pusher = require('com.pusher');
Pusher.setup({
  key: '19b42ae2dab4161a8223',     // CHANGEME
  appID: '19415',                   // CHANGEME
  secret: '93da06922cef9cb43092',  // CHANGEME
  reconnectAutomaticaly: true
});
//
// create base UI tab and root window
//
var win = Titanium.UI.createWindow({
    title:'Groupees Mobile',
    backgroundColor:'#fff'
});

var label = Titanium.UI.createLabel({
	color:'#999',
	text:'Groupees',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win.add(label);

var intent = Ti.Android.createIntent({
    flags : Ti.Android.FLAG_ACTIVITY_CLEAR_TOP | Ti.Android.FLAG_ACTIVITY_NEW_TASK,
    // Substitute the correct classname for your application
    className : 'com.groupees.mobile.GroupeesActivity',
});
intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);

// Create a PendingIntent to tie together the Activity and Intent
var pending = Titanium.Android.createPendingIntent({
    intent: intent,
    activity: Ti.Android.currentActivity,
    //flags: Titanium.Android.FLAG_UPDATE_CURRENT
    type: Ti.Android.PENDING_INTENT_FOR_ACTIVITY,
    flags: Titanium.Android.FLAG_CANCEL_CURRENT
});

// Create the notification

// Send the notification.

//
// create controls tab and root window
//

var handleConnected = function() {
  Pusher.addEventListener('connected', function(e) {
    Ti.API.warn("PUSHER CONNECTED");

    // Connect to channel
    win.channel = Pusher.subscribeChannel('test');

    // Bind to all events on this channel
    win.channel.addEventListener('alert', handleEvent);

    // Bind to a specific event on this channel
   //window.channel.addEventListener('alert', handleAlertEvent);
  });
  Pusher.connect();
};

var handleEvent = function(e) {
  //alert(JSON.stringify(e.data));
  Ti.API.warn("MESSAGE IS: "+e.data.title);
  var notification = Titanium.Android.createNotification({
    // icon is passed as an Android resource ID -- see Ti.App.Android.R.
    icon: Titanium.App.Android.R.drawable.icon,
    contentTitle: e.data.title,
    contentText : e.data.message,
    contentIntent: pending,
    defaults:Titanium.Android.NotificationManager.DEFAULT_SOUND
  });

  Titanium.Android.NotificationManager.notify(1, notification);

}

//
//  add tabs
//

handleConnected();

// open tab group
win.open();


text:
<?php

require_once JPATH_BASE."/libraries/dysms/api_sdk/aliyun-php-sdk-core/Config.php" ;
require_once JPATH_BASE.'/libraries/dysms/api_sdk/Dysmsapi/Request/V20170525/SendSmsRequest.php';
require_once JPATH_BASE.'/libraries/dysms/api_sdk/Dysmsapi/Request/V20170525/QuerySendDetailsRequest.php';

 class zmaxcaptchaHelper
 {
	public static function getCode()
	{
		$session = JFactory::getSession();
		$token = $session->getToken();
		$db = JFactory::getDbo();
		$sql = "SELECT code from #__zmaxcaptcha_code WHERE session_id='{$token}'";
		$db->setQuery($sql);
		$code = $db->loadResult();
		return $code;

	}

	public static function deleteCode()
	{
		$date =JDate::getInstance();
		$now = $date->toUnix();
		$db = JFactory::getDbo();
		$sql = "DELETE from #__zmaxcaptcha_code WHERE end_date<{$now}";
		$db->setQuery($sql);
		$db->query();
	}

	public  static function sessionExist()
	{
		$session = JFactory::getSession();
		$token = $session->getToken();
		$db = JFactory::getDbo();
		$sql = "SELECT * from #__zmaxcaptcha_code WHERE session_id='{$token}'";
		$db->setQuery($sql);
		$result = $db->loadObject();
		return $result;
	}

	public static function updateCode($code)
	{
		$session = JFactory::getSession();
		$token = $session->getToken();
		$db = JFactory::getDbo();
		$sql = "UPDATE #__zmaxcaptcha_code SET code='{$code}' WHERE session_id='{$token}'";
		$db->setQuery($sql);
		return $db->query();
	}

	public static function insertCode($code)
	{
		$session = JFactory::getSession();
		$token = $session->getToken();

		$date =JDate::getInstance();
		$start_time = $date->toUnix();
		$end_time = $start_time + 600;
		$db = JFactory::getDbo();
		$sql = "INSERT INTO #__zmaxcaptcha_code(session_id,type,code,start_date,end_date) VALUES ('$token','normal','$code','$start_time','$end_time' )";
		$db->setQuery($sql);
		return $db->query();
	}

	public  static function saveCode($code)
	{
		if(self::sessionExist())
		{
			 self::updateCode($code);
			 self::deleteCode();
		}
		else
		{
			 self::insertCode($code);
			 self::deleteCode();
		}
	}

	public  static function  sendMsg($phone_no)
	{
		self::_sendMsg($phone_no);

	}

   protected static function _makeRandomNum($length)
   {
		$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
		$key="";
		for($i=0;$i<$length;$i++)
		{
			$key .= $pattern{rand(0,35)};
		}
		return $key;
  }
	protected static  function _getrandomNo($smslength)
	{
		 $randomNo ="";
		 $characters = array("0","1","2","3","4","5","6","7","8","9");
			$keys = array();
			while(count($keys) < $smslength) {
				$x = mt_rand(0, count($characters)-1);
				if(!in_array($x, $keys)) {
				   $keys[] = $x;
				}
			}
			foreach($keys as $key){
			   $randomNo .= $characters[$key];
			}
		return $randomNo;
	 }

	public static function sendSmsVerify($tomobileno) {

		$params	= JComponentHelper::getParams('com_zmaxcaptcha');

		$accessKeyId = $params->get("user_id");//$accessKeyId
		$accessKeySecret = $params->get("password");//$accessKeySecret
		$time = $params->get("time",1);
		$templateCode = $params->get('msg_template'); //"SMS_75785186"

		//短信API产品名
		$product = "Dysmsapi";
		//短信API产品域名
		$domain = "dysmsapi.aliyuncs.com";
		//暂时不支持多Region
		$region = "cn-hangzhou";

		//初始化访问的acsCleint
		$profile = DefaultProfile::getProfile($region, $accessKeyId, $accessKeySecret);
		DefaultProfile::addEndpoint("cn-hangzhou", "cn-hangzhou", $product, $domain);
		$acsClient= new DefaultAcsClient($profile);

		$request = new Dysmsapi\Request\V20170525\SendSmsRequest;
		//必填-短信接收号码
		$request->setPhoneNumbers($tomobileno);
		//必填-短信签名
		$request->setSignName("人人时代");//人人时代
		//必填-短信模板Code
		$request->setTemplateCode($templateCode);  //SMS_75785186
		//选填-假如模板中存在变量需要替换则为必填(JSON格式)
		//验证码${number},您正进行人人时代的手机验证,注意保密

		$randomNo = self:: _getrandomNo(4);
		$request->setTemplateParam("{\"number\":\"".$randomNo."\"}");
		//选填-发送短信流水号
		$outid	=time().$tomobileno;
		$request->setOutId($outid);

		//发起访问请求
		//  $acsResponse = $acsClient->getAcsResponse($request);
		//return $acsResponse;

		if($acsResponse->Code !=='OK')
		{
			echo "ERROR:".$acsResponse->Code.":". $acsResponse->Message;//"ERROR";
		}
		else
		{
			// echo $acsResponse->Code;
			echo $randomNo;
		}

		//echo $randomNo;
		return true;
		//var_dump($acsResponse);
	   //print_r("acsResponse[Message] =".$acsResponse->Message);
	   //print_r("\\n");
	   //print_r("acsResponse[Code] =".$acsResponse->Code);
	}
	protected static function _sendMsg($phone_no)
	{

		require_once(JPATH_COMPONENT_ADMINISTRATOR."/libs/sms/sms.lib.php");
		$params = JComponentHelper::getParams('com_zmaxcaptcha');

		$uid = $params->get("user_id");
		$pswd = $params->get("password");
		$time = $params->get("time",1);
		$message = $params->get('msg_template');
		$code = self:: _makeRandomNum(4);
		$message = str_replace("_##CODE##_",$code ,$message);

		$message = mb_convert_encoding($message,"gb2312","utf-8");
		$fields = array(
		'CorpID'=>urlencode($uid),
		'Pwd'=>urlencode($pswd),
		'Mobile'=>urlencode($phone_no),
		'Content'=>urlencode($message),
		'Cell'=>'',
		'SendTime'=>''
        );

		$url = "http://www.106551.com/ws/Send.aspx";
		$result = execPostRequest($url,$fields);

		if(0!= $result)
		{
			echo "ERROR";
		}
		else
		{
			echo $code;
		}
		return true;
	}
 }

 ?>


text:
Namespace Errors

    Public Module _Shared

        Private _FallbackPath As String = ""
        Private _Errors As New List(Of Models.Error)
        Private _LastError As Models.Error = Nothing

        Private Function GetErrorLogPath() As String
            Dim LogPath As String = ""
            If String.IsNullOrEmpty(Settings.ErrorLogPath) OrElse Not Settings.ErrorLogPath.Contains("\") Then
                LogPath = GetFallbackPath()
            Else
                LogPath = Settings.ErrorLogPath
            End If
            Dim LogDirectory As String = IO.Path.GetDirectoryName(LogPath)
            If Not IO.Directory.Exists(LogDirectory) Then
                IO.Directory.CreateDirectory(LogDirectory)
            End If
            Return LogPath
        End Function

        Private Function GetFallbackPath() As String
            If String.IsNullOrEmpty(_FallbackPath) Then
                _FallbackPath = "{0}Errors.log".FormatWith(Settings.Directories.AppDataCompanyProductVersion)
            End If
            Return _FallbackPath
        End Function

        Public Function GetErrors() As IEnumerable(Of Models.Error)
            Return _Errors.ToList
        End Function

        Private Sub InvokeAddError([error] As Models.Error, silent As Boolean, ByRef AddError As Delegates.AddError)
            Try
                If silent OrElse AddError Is Nothing Then
                Else
                    AddError.Invoke([error])
                End If
            Catch
            End Try
        End Sub

        Public Async Function AddError_DB(e As Models.Error) As Task
            Dim DBError As New Models.DMSLOG.Error With {
                .Date = e.ErrorDate,
                .MachineName = e.MachineName,
                .Product = e.ProductString,
                .Title = e.Title,
                .UserID = e.UserID,
                .Version = e.Version
            }
            If e.ErrorException Is Nothing Then
                DBError.Message = e.ErrorMessage
            Else
                DBError.Message = e.ErrorException.Message
            End If
            Await DBError.Upsert()
        End Function

        Public Sub Application_ThreadException(sender As Object, e As Threading.ThreadExceptionEventArgs)
            Try
                Dim MethodName As String = ""
                Try
                    Dim Frame As New System.Diagnostics.StackFrame(1, False)
                    MethodName = Frame.GetMethod().Name
                Catch exInner As Exception
                End Try
                e.Exception.ToLog(True, "Application.ThreadException - MethodName: {0}".FormatWith(MethodName))
            Catch ex As Exception
            End Try
        End Sub

        Public Sub CurrentDomain_UnhandledException(sender As Object, e As UnhandledExceptionEventArgs)
            Try
                Dim MethodName As String = ""
                Try
                    Dim Frame As New System.Diagnostics.StackFrame(1, False)
                    MethodName = Frame.GetMethod().Name
                Catch exInner As Exception
                End Try
                DirectCast(e.ExceptionObject, Exception).ToLog(True, "CurrentDomain.UnhandledException - MethodName: {0}, IsTerminating: {1}".FormatWith(MethodName, e.IsTerminating))
            Catch ex As Exception
            End Try
        End Sub

        Public Sub LogError([error] As Models.Error)
            LogError([error], False)
        End Sub

        Public Sub LogError([error] As Models.Error, silent As Boolean)
            _LastError = [error]
            _Errors.Add(_LastError)

            InvokeAddError([error], silent, Settings.AddErrorToDB)
            If Settings.AddErrorToFile Is Nothing Then
                IORoutines.WriteToFile(True, True, GetErrorLogPath(), False, [error].ErrorDetails)
            Else
                InvokeAddError([error], silent, Settings.AddErrorToFile)
            End If
            InvokeAddError([error], silent, Settings.AddErrorToForm)
            InvokeAddError([error], silent, Settings.AddErrorToMessage)
        End Sub

    End Module

End Namespace


text:
/**
* @description {Class} wdTree
* This is the main class of wdTree.
*/
(function ($) {
    //declare 3 array variables for separately storing the list of offeringLevel1, offeringLevel2 and offeringsLevel3
    var offeringLevel1 = [];
    var offeringLevel2 = [];
    var offeringLevel3 = [];
    var offeringSelectedItems = 0;
    $.fn.swapClass = function (c1, c2) {
        return this.removeClass(c1).addClass(c2);
    };
    $.fn.switchClass = function (c1, c2) {
        if (this.hasClass(c1)) {
            return this.swapClass(c1, c2);
        }
        else {
            return this.swapClass(c2, c1);
        }
    };
    $.fn.offeringtreeview = function (settings) {
        var dfop =
            {
                method: "POST",
                datatype: "json",
                /**
                * @description {Config} url
                * {String} Url for child nodes retrieving. im
                */
                url: false,
                /**
                * {String} Checkbox image path.
                */
                cbiconpath: "../../Styles/TreeMenuCss/images/icons/",
                icons: ["checkbox_0.gif", "checkbox_1.gif", "checkbox_2.gif"],
                /**
                * {Boolean} Whether to show check box or not.
                */
                showcheck: false,

                /*
                * Fired when check box is clicked on.
                */
                oncheckboxclick: false,
                /**
                * Fired when a node is clicked on.
                */
                onnodeclick: false,
                /**
                * @description {Config} cascadecheck
                * {Boolean} Whether node being seleted leads to parent/sub node being selected.
                */
                cascadecheck: true,

                /**
                * @description {Config} data
                * {Object} Tree theme. Three themes provided. 'bbit-tree-lines' ,'bbit-tree-no-lines' and 'bbit-tree-arrows'.
                * @sample
                * data:[{
                * id:"node1", //node id
                * text:"node 1", //node text for display.
                * value:"1", //node value
                * showcheck:false, //whether to show checkbox
                * checkstate:0, //Checkbox checking state. 0 for unchecked, 1 for partial checked, 2 for checked.
                * hasChildren:true, //If hasChildren and complete set to true, and ChildNodes is empty, tree will request server to get sub node.
                * isexpand:false, //Expand or collapse.
                * complete:false, //See hasChildren.
                * ChildNodes:[] // child nodes
                * }]
                *  */
                data: null,
                /**
                * {String} Whether to toggle node when node clicked.
                */
                clicktoggle: true,
                /**
                * {String} Tree theme. Three themes provided. 'bbit-tree-lines' ,'bbit-tree-no-lines' and 'bbit-tree-arrows'.
                */
                theme: "bbit-tree-lines" //bbit-tree-lines ,bbit-tree-no-lines,bbit-tree-arrows
            };
        var me = $(this);

        $.extend(dfop, settings);
        var treenodes = dfop.data;
        offeringallNodes = dfop.data;
        var id = me.attr("id");   //---------------------------------------------------------------node-1
        if (id == null || id == "") {
            id = "bbtree" + new Date().getTime();
            me.attr("id", id);
        }

        var html = [];
        buildtree(dfop.data, html);
        me.addClass("bbit-tree").html(html.join(""));
        InitEvent(me);

        $("#OffTreeClearSelect").click(nodeclick);
        //if identifierForOfferingTree is true, it's async tree, expland the root node(all)
        if (identifierForOfferingTree) {
            $("#offeringTree .bbit-tree-ec-icon").click();
        }

        html = null;

        //pre load the icons
        if (dfop.showcheck) {
            for (var i = 0; i < 3; i++) {
                var im = new Image();
                im.src = dfop.cbiconpath + dfop.icons[i];
            }
        }

        //region
        function buildtree(data, ht) {
            ht.push("
"); // Wrap ;
            ht.push("
"); // body ;
            ht.push("
"); //root   --------------------------------------theme:bbit-tree-arrows
            if (data && data.length > 0) {
                var l = data.length;
                for (var i = 0; i < l; i++) {
                    buildnode(data[i], ht, 0, i, i == l - 1);         //------------------data[i]:childnodes     ht:html,   0,  (0-2), (2)
                }
                treenodes = data;
                dfop.data = data;
            }
            else {                                                  //can be commented
                asnyloadc(null, false, function (data) {
                    if (data && data.length > 0) {
                        treenodes = data;
                        dfop.data = data;
                        var l = data.length;
                        for (var i = 0; i < l; i++) {
                            buildnode(data[i], ht, 0, i, i == l - 1);
                        }
                    }
                });
            }                                                    //can be commented
            ht.push("
"); // root and;
            ht.push("
"); // body end;
            ht.push("
"); // Wrap end;
        }

        //endregion
        function buildnode(nd, ht, deep, path, isend) {   //------------------data[i]:childnodes     ht:html,   0,  (0-2), (2)

            //treeNodesCount = treeNodesCount + 1;

            //create a level attribute for each node
            //added 3/26
            //identifierForOfferingTree is used to recognize whether it's search tree or async tree
            var level = deep;
            if (!identifierForOfferingTree) {

                var oldWidth1 = 180; //the old width of product tree div(id:tree)
                var oldWidth2 = 180; //the old width of close product tree div(id:closeTreeDiv)
                var searchTextbox = 170;
                if ($("#offeringTree").width() < 340) {
                    for (var i = 0; i < deep; i++) {
                        oldWidth1 += 50;
                        oldWidth2 += 50;
                        searchTextbox += 50;
                    }
                    $("#offeringTree").width(oldWidth1);
                    $("#closeOfferingTreeDiv").width(oldWidth2);
                    $("#searchOffTrDiv").width(oldWidth2);
                    $("#offTrMatchTextbox").width(searchTextbox);
                    $("#offeringNameList").width(oldWidth2);
                    $("#calculatingDiv").width(oldWidth2);
                }
            }
            //var nid = nd.id.replace(/[^\w]/gi, "_");     //-------------------nd.id="node-1";   \w:look at words      nid:node_1
            var nid = nd.id     //-------------------nd.id="node-1";   \w:look at words      nid:node_1
            ht.push("
");
            ht.push("<div id='", id, "_", nid, "' tpath='", path, "' level='", level, "' unselectable='on' title='", nd.Text, "'");
            var cs = [];
            cs.push("bbit-tree-node-el");    //------------------cs is used to set the folder style or end nodes style, can be deleted
            if (nd.hasChildren) {
                cs.push(nd.isexpand ? "bbit-tree-node-expanded" : "bbit-tree-node-collapsed");
            }
            else {
                cs.push("bbit-tree-node-leaf");
            }
            if (nd.classes) { cs.push(nd.classes); }

            ht.push(" class='", cs.join(" "), "'>");     //----------------------------set the value of class of div
            //span indent
            ht.push("");
            if (deep == 1) {                            //-------------------------deep:0
                ht.push("");
            }
            else if (deep > 1) {
                ht.push("");
                for (var j = 1; j < deep; j++) {
                    ht.push("");
                }
            }
            ht.push("");
            //img
            cs.length = 0;
            if (nd.hasChildren) {
                if (nd.isexpand) {
                    cs.push(isend ? "bbit-tree-elbow-end-minus" : "bbit-tree-elbow-minus");
                }
                else {
                    cs.push(isend ? "bbit-tree-elbow-end-plus" : "bbit-tree-elbow-plus");
                }
            }
            else {
                cs.push(isend ? "bbit-tree-elbow-end" : "bbit-tree-elbow");
            }
            ht.push("");
            //ht.push("");  //edit:delete folder icons
            //----------------------------------------------------------------------for loading.gif--------------------------------------------------------------
            ht.push(""); //edit:hide the folder icons &&loading image when plus is clicked
            //---------------------------------------------------------------------------------------------------------------------------------------------------

            //------------------------------------------------------highlight offeringmatchString--------------------------------------
            //if the text of node includes the value of search textbox of product tree, hightlight this part
            var reg = new RegExp(offeringmatchString, "i");
            var hightLightValue = nd && nd.Text && nd.Text.match(reg);
            var noHightLightValue = "";
            var nodeText = "";
            if (!hightLightValue == null || !hightLightValue == "") {
                var startIndex = nd.Text.toLocaleLowerCase().indexOf(offeringmatchString.toLocaleLowerCase());
                //startIndex=0:the offeringmatchString is at the begining
                if (startIndex == 0) {
                    noHightLightValue = nd.Text.substr(offeringmatchString.length);
                    nodeText = "" + hightLightValue + "" + noHightLightValue;
                }
                //evaluate whether the match string occurs at the end
                else if (startIndex == nd.Text.length - offeringmatchString.length) {
                    noHightLightValue = nd.Text.substring(0, startIndex);
                    nodeText = noHightLightValue + "" + hightLightValue + "";
                }
                //the offeringmatchString occurs at the middle position
                else {
                    var startValue = nd.Text.substring(0, startIndex);
                    var endValue = nd.Text.substr(startIndex + offeringmatchString.length);
                    nodeText = startValue + "" + hightLightValue + "" + endValue;
                }

            }
            else {
                nodeText = nd.Text;
            }
            //------------------------------------------------------------------end---------------------------------------------

            //checkbox
            if (dfop.showcheck && nd.showcheck) {
                if (nd.checkstate == null || nd.checkstate == undefined) {
                    nd.checkstate = 0;
                }
                ht.push("");
                //a
                ht.push("");
                ht.push("", nodeText, "");
                ht.push("");
            }
            else {
                //a
                ht.push("");
                ht.push("", nodeText, "");
                ht.push("");
            }
            //
            //a
            ht.push("
");
            //Child
            if (nd.hasChildren) {
                if (nd.isexpand) {
                    ht.push("
");
                    if (nd.ChildNodes) {
                        var l = nd.ChildNodes.length;
                        for (var k = 0; k < l; k++) {
                            nd.ChildNodes[k].parent = nd;
                            buildnode(nd.ChildNodes[k], ht, deep + 1, path + "." + k, k == l - 1);
                        }
                    }
                    ht.push("
");
                }
                else {
                    ht.push("

");
                }
            }
            ht.push("
");
            nd.render = true;
            //--------------------------------------------------------------------------------------hide the loading gif--------------------------------
            $(".bbit-tree-node-icon").hide();
            //---------------------------------------------------------------------------------------end---------------------------------------------------------
        }
        function getItem(path) {
            var ap = path.split(".");
            var t = treenodes;
            for (var i = 0; i < ap.length; i++) {
                if (i == 0) {
                    t = t[ap[i]];
                }
                else {
                    t = t.ChildNodes[ap[i]];  //dfasfaskdfjlaksdf----------------------------------------------------------------------------
                }
            }
            return t;
        }

        function check(item, state, type) { //0 1  1(gif)
            var pstate = item.checkstate;
            if (type == 1) {
                item.checkstate = state;
            }
            else {// go to childnodes
                var cs = item.ChildNodes;
                var l = cs.length;
                var ch = true;
                for (var i = 0; i < l; i++) {
                    if ((state == 1 && cs[i].checkstate != 1) || state == 0 && cs[i].checkstate != 0) {
                        ch = false;
                        break;
                    }
                }
                if (ch) {
                    item.checkstate = state;
                }
                else {
                    item.checkstate = 2;
                }
            }
            //change show and store the value of checkbox to the hidden string
            if (item.render && pstate != item.checkstate) {
                //                var nid = item.id.replace(/[^\w]/gi, "_");
                var nid = item.id;
                var et = $("#" + id + "_" + nid + "_cb");
                if (et.length == 1) {
                    et.attr("src", dfop.cbiconpath + dfop.icons[item.checkstate]);
                    //estimate the item.checkstate, 0
                    if (item.checkstate == 0) {
                        if (item.Level == 1) {
                            var pOfElement = IsInArrayOff(item.Value, offeringLevel1);
                            if (pOfElement > -1) {
                                offeringLevel1.splice(pOfElement, 1);
                            }
                        }
                        if (item.Level == 2) {
                            var pOfElement = IsInArrayOff(item.Value, offeringLevel2);
                            if (pOfElement > -1) {
                                offeringLevel2.splice(pOfElement, 1);
                            }
                        }
                        if (item.Level == 3) {
                            var pOfElement = IsInArrayOff(item.Value, offeringLevel3);
                            if (pOfElement > -1) {
                                offeringLevel3.splice(pOfElement, 1);
                            }
                        }
                    }
                    else {
                        if (item.Level == 1) {
                            var pOfElement1 = IsInArrayOff(item.Value, offeringLevel1);
                            if (pOfElement1 == -1) {
                                AddEleInArrayOff(item.Value, offeringLevel1);
                            }
                        }
                        if (item.Level == 2) {
                            var pOfElement2 = IsInArrayOff(item.Value, offeringLevel2);
                            var pOfElement1 = IsInArrayOff(item.parent.Value, offeringLevel1);
                            if (pOfElement2 == -1) {
                                AddEleInArrayOff(item.Value, offeringLevel2);
                            }
                            if (pOfElement1 == -1) {
                                AddEleInArrayOff(item.parent.Value, offeringLevel1);
                            }
                        }
                        if (item.Level == 3) {
                            var pOfElement3 = IsInArrayOff(item.Value, offeringLevel3);
                            var pOfElement2 = IsInArrayOff(item.parent.Value, offeringLevel2);
                            var pOfElement1 = IsInArrayOff(item.parent.parent.Value, offeringLevel1);
                            if (pOfElement3 == -1) {
                                AddEleInArrayOff(item.Value, offeringLevel3);
                            }
                            if (pOfElement2 == -1) {
                                AddEleInArrayOff(item.parent.Value, offeringLevel2);
                            }
                            if (pOfElement1 == -1) {
                                AddEleInArrayOff(item.parent.parent.Value, offeringLevel1);
                            }
                        }
                    }

                }
                $("#OffLevel1Hidden").val(offeringLevel1.join('^'));
                $("#OffLevel2Hidden").val(offeringLevel2.join('^'));
                $("#OffLevel3Hidden").val(offeringLevel3.join('^'));
            }
        }

        function IsInArrayOff(ele, arr) {
            return $.inArray(ele, arr);
        }
        function AddEleInArrayOff(ele, arr) {
            arr.push(ele);
        }

        //iterate all children nodes
        function cascade(fn, item, args) {
            if (fn(item, args, 1) != false) {
                if (item.ChildNodes != null && item.ChildNodes.length > 0) {
                    var cs = item.ChildNodes;
                    for (var i = 0, len = cs.length; i < len; i++) {
                        cascade(fn, cs[i], args);
                    }
                }
            }
        }
        //bubble to parent
        function bubble(fn, item, args) {
            var p = item.parent;
            while (p) {
                if (fn(p, args, 0) === false) {
                    break;
                }
                p = p.parent;
            }
        }

        function nodeclick(e) {

            var et = e.target || e.srcElement;
            if (et.id == "OffTreeClearSelect") {
                path = "0";
                item = getItem(path);
                var state = 0;
                item.itemstate = 0;
                cascade(check, item, state);
                offeringselectedProducts = "";
                offeringSelectedItems = 0;
                $("#txtOfferingTree").attr("value", "Selected all items");
                $("#txtOfferingTreeHidden").attr("value", "");
                return;
            }
            var path = $(this).attr("tpath");
            var nodeLevel = $(this).attr("level");
            var item = getItem(path);
            if (et.tagName == "IMG" || (et.tagName == "SPAN" && nodeLevel > 1) || et.tagName == "FONT") {

                var ul = $(this).next(); //"bbit-tree-node-ct"
                //+ if collapsed, expend it
                if ($(et).hasClass("bbit-tree-elbow-plus") || $(et).hasClass("bbit-tree-elbow-end-plus")) {

                    //                    var ul = $(this).next(); //"bbit-tree-node-ct"
                    //                    if (ul.hasClass("bbit-tree-node-ct")) {
                    //                        ul.show();
                    //                    }
                    //                    else {

                    //-----------------------------------------------------------------------------show checkbox
                    //                    var divId = $(this).attr("id");
                    //                    $("#" + divId + " .bbit-tree-node-cb").show();
                    //------------------------------------------------------------------------------show checkbox end
                    var deep = path.split(".").length;
                    //--------------------------------------------------------------------------change the width of product tree div----------------------------

                    var nodeLevel = $(this).attr("level");
                    //get the count of nodes under this level
                    var countOfNodes = $("div[level='" + nodeLevel + "'").next("ul:visible").length;
                    if (countOfNodes == 0) {
                        var oldWidth1 = 180; //the old width of product tree div(id:tree)
                        var oldWidth2 = 180; //the old width of close product tree div(id:closeTreeDiv)
                        var searchTextbox = 170;
                        nodeLevel = parseInt(nodeLevel) + 1;
                        if ($("#offeringTree").width() < 340) {
                            for (var i = 0; i < nodeLevel; i++) {
                                oldWidth1 += 50;
                                oldWidth2 += 50;
                                searchTextbox += 50;
                            }
                            $("#offeringTree").width(oldWidth1);
                            $("#closeOfferingTreeDiv").width(oldWidth2);
                            $("#searchOffTrDiv").width(oldWidth2);
                            $("#offTrMatchTextbox").width(searchTextbox);
                            $("#offeringNameList").width(oldWidth2);
                            $("#calculatingDiv").width(oldWidth2);
                        }
                    }

                    //------------------------------------------------------------------------------end--------------------------------------
                    //this if statement will asynbuild all child nodes(to last child node) under the search features, that affect the user experience
                    //so comment it(if and else)
                    //                    if (item.complete) {
                    //                        item.ChildNodes != null && asnybuild(item.ChildNodes, deep, path, ul, item);
                    //                    }
                    //                    else {
                    $(this).addClass("bbit-tree-node-loading");
                    //-----------------------------------------------------------------show loading image-------------------------------
                    $(this).find(".bbit-tree-node-icon").show();
                    //-------------------------------------------------------------------end------------------------------------
                    asnyloadc(item, true, function (data) {
                        var datas = $.parseJSON(data);
                        item.complete = true;
                        item.ChildNodes = datas;
                        if (item.checkstate == 1 && item.Level == 2) {
                            $.each(datas, function (key, val) {
                                var isExist = IsInArrayOff(val.Text, offeringLevel3);
                                if (isExist == -1) {
                                    offeringLevel3.push(val.Text);
                                }
                            });
                            $("#OffLevel3Hidden").val(offeringLevel3.join('^'));
                        }
                        asnybuild(datas, deep, path, ul, item);
                        setupSizeOfTree();
                    });
                    //                    }
                    //                    }
                    if ($(et).hasClass("bbit-tree-elbow-plus")) {
                        $(et).swapClass("bbit-tree-elbow-plus", "bbit-tree-elbow-minus");
                    }
                    else {
                        $(et).swapClass("bbit-tree-elbow-end-plus", "bbit-tree-elbow-end-minus");
                    }
                    $(this).swapClass("bbit-tree-node-collapsed", "bbit-tree-node-expanded");
                }
                //if expended, collapse it
                else if ($(et).hasClass("bbit-tree-elbow-minus") || $(et).hasClass("bbit-tree-elbow-end-minus")) {
                    //--------------------------------------------------------------------------change the width of product tree div--------------------------
                    //added 3/26
                    var nodeLevel = $(this).attr("level");
                    //get the count of nodes under this level
                    nodeLevel = parseInt(nodeLevel);
                    var countOfNodes = $("#offeringTree div[level='" + nodeLevel + "'").next(" ul:visible").length;
                    if (countOfNodes == 1 && nodeLevel < 3) {
                        var oldWidth1 = 180; //the old width of product tree div(id:tree)
                        var oldWidth2 = 180; //the old width of close product tree div(id:closeTreeDiv)
                        var searchTextbox = 170;
                        if (oldWidth1 < 340) {
                            for (var i = 0; i < nodeLevel; i++) {
                                oldWidth1 += 50;
                                oldWidth2 += 50;
                                searchTextbox += 50;
                            }
                        }

                        $("#offeringTree").width(oldWidth1);
                        $("#closeOfferingTreeDiv").width(oldWidth2);
                        $("#searchOffTrDiv").width(oldWidth2);
                        $("#offTrMatchTextbox").width(searchTextbox);
                        $("#offeringNameList").width(oldWidth2);
                        $("#calculatingDiv").width(oldWidth2);
                    }

                    var deep = path.split(".").length;

                    $(this).next().hide();
                    if ($(et).hasClass("bbit-tree-elbow-minus")) {
                        $(et).swapClass("bbit-tree-elbow-minus", "bbit-tree-elbow-plus");
                    }
                    else {
                        $(et).swapClass("bbit-tree-elbow-end-minus", "bbit-tree-elbow-end-plus");
                    }
                    $(this).swapClass("bbit-tree-node-expanded", "bbit-tree-node-collapsed");
                    setupSizeOfTree();
                }
                else if ($(et).hasClass("bbit-tree-node-cb") || $(et).hasClass("bbit-tree-node-span") || et.tagName == "FONT") // click on checkbox
                {

                    //if the checkbox's level 2, get/remove its next nodes' values
                    if (nodeLevel == 2) {
                        if (item.checkstate == 0) {
                            asnyloadc(item, true, function (data) {
                                var datas = $.parseJSON(data);
                                $.each(datas, function (key, val) {
                                    var isExist = IsInArrayOff(val.Text, offeringLevel3);
                                    if (isExist == -1) {
                                        offeringLevel3.push(val.Text);
                                    }
                                });
                                $("#OffLevel3Hidden").val(offeringLevel3.join('^'));
                            });
                        }
                        if (item.checkstate == 1) {
                            asnyloadc(item, true, function (data) {
                                var datas = $.parseJSON(data);
                                $.each(datas, function (key, val) {
                                    var isExist = IsInArrayOff(val.Text, offeringLevel3);
                                    if (isExist > -1) {
                                        offeringLevel3.splice(isExist, 1);
                                    }
                                });
                                $("#OffLevel3Hidden").val(offeringLevel3.join('^'));
                            });
                        }
                    }
                    //if the checkbox's level 2, get/remove its next nodes' values
                    if (nodeLevel == 1) {
                        if (item.checkstate == 0) {
                            asnyloadc(item, true, function (data) {
                                var datas = $.parseJSON(data);
                                $.each(datas, function (key, val) {
                                    var isExist = IsInArrayOff(val.Text, offeringLevel2);
                                    if (isExist == -1) {
                                        offeringLevel2.push(val.Text);
                                    }
                                });
                                $("#OffLevel2Hidden").val(offeringLevel2.join('^'));
                            });

                            LoadLevel3ByLevel1(item.Text, "push");
                        }
                        if (item.checkstate == 1) {
                            asnyloadc(item, true, function (data) {
                                var datas = $.parseJSON(data);
                                $.each(datas, function (key, val) {
                                    var isExist = IsInArrayOff(val.Text, offeringLevel2);
                                    if (isExist > -1) {
                                        offeringLevel2.splice(isExist, 1);
                                    }
                                });
                                $("#OffLevel2Hidden").val(offeringLevel2.join('^'));
                            });
                             LoadLevel3ByLevel1(item.Text, "slice");

                        }
                    }

                    //---disable the ok button when the onclick event of checkbox is executing
                    $("#OffTreeConfirmSelect").attr("disabled", "disabled");
                    $("#txtOfferingTree").attr("value", "calculating items");
                    //--end

                    //get the position of product tree div
                    var position = $("#offeringTree").position();
                    var heightOfcalculatingDiv = $("#closeOfferingTreeDiv").height();
                    $("#calculatingDiv").height(heightOfcalculatingDiv + 28);
                    //set the position of calculatingDiv and DisableProductTreeDiv
                    $("#calculatingDiv").css("left", position.left);
                    $("#calculatingDiv").css("top", position.top);

                    $("#calculatingDiv").show();
                    //$("#DisableProductTreeDiv").show();
                    //--------------------------------------------Is Checkbox for level 3 or 4-------------------------------------------
                    var productLevel5Name
                    var productLevel4Name
                    var productLevel3Name
                    var productLevel2Name
                    var productLevel1Name
                    var checkAction = item.checkstate != 1 ? 1 : 0
                    if (item["Level"] == 5) {
                        productLevel5Name = item["Text"];
                        productLevel4Name = item["parent"]["Text"];
                        productLevel3Name = item["parent"]["parent"]["Text"];
                        productLevel2Name = item["parent"]["parent"]["parent"]["Text"];
                        productLevel1Name = item["parent"]["parent"]["parent"]["parent"]["Text"];
                    }
                    if (item["Level"] == 4) {
                        productLevel4Name = item["Text"];
                        productLevel3Name = item["parent"]["Text"];
                        productLevel2Name = item["parent"]["parent"]["Text"];
                        productLevel1Name = item["parent"]["parent"]["parent"]["Text"];
                        productLevel5Name = "";
                    }
                    if (item["Level"] == 3) {
                        productLevel3Name = item["Text"];
                        productLevel2Name = item["parent"]["Text"];
                        productLevel1Name = item["parent"]["parent"]["Text"];
                        productLevel4Name = "";
                        productLevel5Name = "";
                    }
                    if (item["Level"] == 2) {
                        productLevel2Name = item["Text"];
                        productLevel1Name = item["parent"]["Text"];
                        productLevel3Name = "";
                        productLevel4Name = "";
                        productLevel5Name = "";
                    }
                    if (item["Level"] == 1) {
                        productLevel1Name = item["Text"];
                        productLevel2Name = "";
                        productLevel3Name = "";
                        productLevel4Name = "";
                        productLevel5Name = "";
                    }
                    //if (item.Level == 3 || item.Level == 4 || item.Level == 2) {

                    var postUrl = window.location.protocol + "//" + window.location.host + pathDir + "/GetLeafsOfProductTree.srv";
                    $.post(postUrl, { TreeType: "offeringtree", IsCheckbox: true, PL1Name: productLevel1Name, PL2Name: productLevel2Name, PL3Name: productLevel3Name, PL4Name: productLevel4Name, PL5Name: productLevel5Name, Level: item.Level }, function (data1) {
                        var getData = $.parseJSON(data1);

                        //                        $.each(getData, function (key, val) {
                        //                            offeringselectedProducts = val.LeafsId;
                        //                            offeringSelectedItems = val.Leafs;
                        //                        });
                        //                        $("#txtOfferingTree").attr("value", "Selected " + offeringSelectedItems + " item(s)");
                        //                        $("#txtOfferingTreeHidden").attr("value", offeringselectedProducts);
                        //                        $("#OffTreeConfirmSelect").removeAttr("disabled");
                        //                        $("#calculatingDiv").hide();
                        //
                        if (item.checkstate == 1) {
                            var productsArray = offeringselectedProducts.split(",");
                            $.each(getData, function (key, val) {

                                var existInArray = $.inArray(val.LeafsId, productsArray);
                                if (existInArray == -1) {
                                    offeringselectedProducts += val.LeafsId + ",";
                                }
                            });
                            var productLeafs = offeringselectedProducts.substring(0, offeringselectedProducts.length - 1);
                            var offeringSelectedItems = productLeafs.split(",").length;
                            if (offeringselectedProducts == '') {
                                offeringSelectedItems = 0;
                                $("#txtOfferingTree").attr("value", "Selected all item");
                            }
                            else {
                                offeringSelectedItems = productLeafs.split(",").length;
                                $("#txtOfferingTree").attr("value", "Selected " + offeringSelectedItems + " items");
                            }

                            $("#txtOfferingTreeHidden").attr("value", offeringselectedProducts);
                            $("#OffTreeConfirmSelect").removeAttr("disabled");
                            $("#calculatingDiv").hide();
                            //$("#DisableProductTreeDiv").hide();
                        }
                        if (item.checkstate == 0) {
                            offeringselectedProducts = offeringselectedProducts.substring(0, offeringselectedProducts.length - 1);
                            var productsArray = offeringselectedProducts.split(",");

                            $.each(getData, function (key, val) {
                                var existInArray = $.inArray(val.LeafsId, productsArray);
                                if (existInArray > -1) {
                                    productsArray.splice(existInArray, 1);
                                }

                            });
                            if (productsArray.length == 0) {
                                offeringselectedProducts = "";
                            }
                            else {
                                offeringselectedProducts = productsArray.join(",");

                                offeringselectedProducts += ",";
                            }
                            var productLeafs = offeringselectedProducts.substring(0, offeringselectedProducts.length - 1);
                            var offeringSelectedItems = productLeafs.split(",").length;
                            if (offeringselectedProducts == '') {
                                offeringSelectedItems = 0;
                                $("#txtOfferingTree").attr("value", "Selected all item");
                            }
                            else {
                                offeringSelectedItems = productLeafs.split(",").length;
                                $("#txtOfferingTree").attr("value", "Selected " + offeringSelectedItems + " items");
                            }
                            $("#txtOfferingTreeHidden").attr("value", offeringselectedProducts);
                            $("#OffTreeConfirmSelect").removeAttr("disabled");
                            $("#calculatingDiv").hide();
                            //$("#DisableProductTreeDiv").hide();
                        }
                    });

                    var s = item.checkstate != 1 ? 1 : 0;
                    var r = true;
                    if (dfop.oncheckboxclick) {
                        r = dfop.oncheckboxclick.call(et, item, s);
                        //------------------------------------------
                        asnyloadc(item, true, function (data) {
                            var datas = $.parseJSON(data);
                            item.complete = true;
                            item.ChildNodes = datas;
                            asnybuild(datas, deep, path, ul, item);
                        });
                        //------------------------------------------------------
                    }
                    if (r != false) {
                        if (dfop.cascadecheck) {
                            cascade(check, item, s);
                            bubble(check, item, s);
                        }
                        else {
                            check(item, s, 1);
                        }
                    }
                }
            }

            else {
                if (dfop.citem) {
                    var nid = dfop.citem.id;
                    $("#" + id + "_" + nid).removeClass("bbit-tree-selected");
                }
                dfop.citem = item;
                $(this).addClass("bbit-tree-selected");
                if (dfop.onnodeclick) {
                    if (!item.expand) {
                        item.expand = function () { expandnode.call(item); };
                    }
                    dfop.onnodeclick.call(this, item);
                }
            }
        }
        function expandnode() {
            var item = this;
            //var nid = item.id.replace(/[^\w]/gi, "_");
            var nid = item.id;
            var img = $("#" + id + "_" + nid + " img.bbit-tree-ec-icon");
            if (img.length > 0) {
                img.click();
            }
        }

        //load nodes' name of level 3 by level1's value
        function LoadLevel3ByLevel1(level1, action) {
            var requestUrl = window.location.protocol + "//" + window.location.host + pathDir + "/GetOfferingLevel3ByLevel1.srv";
            $.ajax({
                url: requestUrl,
                type: "GET",
                data: "Level1="+level1,
                dataType: "text",
                success: function (data) {
                    var result = data.split("^");
                    if (action == "push") {
                        $.each(result, function (key, val) {
                            var isExist = IsInArrayOff(val, offeringLevel3);
                            if (isExist == -1) {
                                offeringLevel3.push(val);
                            }
                        });
                        $("#OffLevel3Hidden").val(offeringLevel3.join('^'));
                    }
                    if (action == "slice") {
                        $.each(result, function (key, val) {
                            var isExist = IsInArrayOff(val, offeringLevel3);
                            if (isExist > -1) {
                                offeringLevel3.splice(isExist, 1);
                            }
                        });
                        $("#OffLevel3Hidden").val(offeringLevel3.join('^'));
                    }
                }
            });

        }

        function setupSizeOfTree() {
            var newHeightOfTree = 0;
            var newHeightOfCloseTree = 0;
            var firstNodes = $("#offeringTree div[level='0']").next("ul").children("li");
            var count = firstNodes.length;
            var totalCount = CalculateTotalNodes(firstNodes, count);
            //plus the root node
            totalCount += 1;
            if (totalCount < 11) {
                newHeightOfTree = 180;
            }
            else if (totalCount > 10 && totalCount < 31) {
                newHeightOfTree = totalCount * 18;
            }
            else {
                newHeightOfTree = 30 * 18;
            }
            var newHeightOfCloseTree = newHeightOfTree + 20;
            $("#offeringTree").height(newHeightOfTree);
            $("#closeOfferingTreeDiv").height(newHeightOfCloseTree);
            $("#calculatingDiv").height(newHeightOfCloseTree + 28);
            //$("#calculatingDiv").css("line-height", newHeightOfCloseTree + 28);
            $("#calculatingPar").css("margin-top", ((newHeightOfCloseTree + 28 - 72) / 2));

        }

        function CalculateTotalNodes(nodes, count) {
            $.each(nodes, function (key, val) {
                var childNodes;
                if ($(this).children("ul").is(":visible")) {
                    childNodes = $(this).children("ul").children("li");
                    count += childNodes.length;
                    count = CalculateTotalNodes(childNodes, count);
                }
            });
            return count;
        }

        function asnybuild(nodes, deep, path, ul, pnode) {
            var l = nodes.length;
            if (l > 0) {
                var ht = [];
                var i = 0;
                $.each(nodes, function (key, val) {
                    val.parent = pnode;
                    buildnode(val, ht, deep, path + "." + i, i == l - 1);
                    i += 1;
                });
                //                for (var i = 0; i < l; i++) {
                //                    nodes[i].parent = pnode;
                //                    buildnode(nodes[i], ht, deep, path + "." + i, i == l - 1);
                //                }
                ul.html(ht.join(""));
                ht = null;
                InitEvent(ul);

                //-------------------------------------------------------------------------------dynamicly change the height of product tree---------------
                //                var oldHeight1 = 180; //the old height of product tree div(id:tree)
                //                var oldHeight2 = 200; //the old height of close product tree div(id:closeTreeDiv)
                //                //var count = $(".bbit-tree-node-ct:visible li").get().length;
                //                var height = $("#offeringTree").height();
                //                if (treeNodesCount > 30) {
                //                    var decreaseCount = 20;  //30 nodes is the max number of product tree container, initialy, the product tree container includes 10
                //                    for (var i = 0; i < decreaseCount; i++) {
                //                        oldHeight1 += 18;
                //                        oldHeight2 += 18;
                //                    }
                //                }
                //                else {
                //                    var decreaseCount = treeNodesCount - 10;
                //                    for (var i = 0; i < decreaseCount; i++) {
                //                        oldHeight1 += 18;
                //                        oldHeight2 += 18;
                //                    }
                //                }
                //                //set the new height for product tree div
                //                $("#offeringTree").height(oldHeight1);
                //                $("#closeOfferingTreeDiv").height(oldHeight2);
                //                $("#calculatingDiv").height(oldHeight2 + 28);
                //                //$("#calculatingDiv").css("line-height", oldHeight2 + 28);
                //                $("#calculatingPar").css("margin-top", ((oldHeight2 + 28 - 72) / 2));

                //------------------------------------------------------------------------------------------------------------end-------------------------------
            }
            ul.addClass("bbit-tree-node-ct").css({ "z-index": 0, position: "static", visibility: "visible", top: "auto", left: "auto", display: "" });
            ul.prev().removeClass("bbit-tree-node-loading");
        }
        function asnyloadc(pnode, isAsync, callback) {
            var productLevel4Name
            var productLevel3Name
            var productLevel2Name
            var productLevel1Name
            var level = 0;
            if (dfop.url) {
                if (pnode["Level"] == 4) {
                    productLevel4Name = pnode["Text"];
                    productLevel3Name = pnode["parent"]["Text"];
                    productLevel2Name = pnode["parent"]["parent"]["Text"];
                    productLevel1Name = pnode["parent"]["parent"]["parent"]["Text"];
                    level = 4;
                }
                if (pnode["Level"] == 3) {
                    productLevel3Name = pnode["Text"];
                    productLevel2Name = pnode["parent"]["Text"];
                    productLevel1Name = pnode["parent"]["parent"]["Text"];
                    productLevel4Name = "";
                    level = 3;
                }
                if (pnode["Level"] == 2) {
                    productLevel2Name = pnode["Text"];
                    productLevel1Name = pnode["parent"]["Text"];
                    productLevel3Name = "";
                    productLevel4Name = "";

                    level = 2;
                }
                if (pnode["Level"] == 1) {
                    productLevel1Name = pnode["Text"];
                    productLevel2Name = "";
                    productLevel3Name = "";
                    productLevel4Name = "";

                    level = 1;
                }
                if (pnode["Level"] == 0) {
                    productLevel1Name = "";
                    productLevel2Name = "";
                    productLevel3Name = "";
                    productLevel4Name = "";
                    level = 0;
                }
                $.post(dfop.url, { IsCheckbox: false, PL1Name: productLevel1Name, PL2Name: productLevel2Name, PL3Name: productLevel3Name, PL4Name: productLevel4Name, Level: level, IsChecked: pnode["checkstate"] }, callback);
                //--------------------------------------------------------added:  IsChecked: pnode["checkstate"]-------------------------------------------
                //                if (pnode && pnode != null)
                //                    var param = builparam(pnode);
                //                $.ajax({
                //                    type: dfop.method,
                //                    url: dfop.url,
                //                    parent: param,
                //                    async: isAsync,
                //                    dataType: dfop.datatype,
                //                    success: callback,
                //                    error: function (e) { alert("error occur!"); }
                //                });
            }
        }
        function builparam(node) {
            var p = [{ name: "id", value: encodeURIComponent(node.id) }
                    , { name: "text", value: encodeURIComponent(node.text) }
                    , { name: "value", value: encodeURIComponent(node.value) }
                    , { name: "parent", value: "All" }
                    , { name: "parentLevel", value: "0" }
                    , { name: "value", value: encodeURIComponent(node.value) }
                    , { name: "checkstate", value: node.checkstate}];
            return p;
        }
        function bindevent() {
            $(this).hover(function () {
                $(this).addClass("bbit-tree-node-over");
            }, function () {
                $(this).removeClass("bbit-tree-node-over");
            }).click(nodeclick)
             .find("img.bbit-tree-ec-icon").each(function (e) {
                 if (!$(this).hasClass("bbit-tree-elbow")) {
                     $(this).hover(function () {
                         $(this).parent().addClass("bbit-tree-ec-over");
                     }, function () {
                         $(this).parent().removeClass("bbit-tree-ec-over");
                     });
                 }
             });
        }
        function InitEvent(parent) {
            var nodes = $("li.bbit-tree-node>div", parent);
            nodes.each(bindevent);
        }
        function reflash(itemId) {
            //            var nid = itemId.replace(/[^\w-]/gi, "_");
            var nid = itemId;
            var node = $("#" + id + "_" + nid);
            if (node.length > 0) {
                node.addClass("bbit-tree-node-loading");
                var isend = node.hasClass("bbit-tree-elbow-end") || node.hasClass("bbit-tree-elbow-end-plus") || node.hasClass("bbit-tree-elbow-end-minus");
                var path = node.attr("tpath");
                var deep = path.split(".").length;
                var item = getItem(path);
                if (item) {
                    asnyloadc(item, true, function (data) {
                        item.complete = true;
                        item.ChildNodes = data;
                        item.isexpand = true;
                        if (data && data.length > 0) {
                            item.hasChildren = true;
                        }
                        else {
                            item.hasChildren = false;
                        }
                        var ht = [];
                        buildnode(item, ht, deep - 1, path, isend);
                        ht.shift();
                        ht.pop();
                        var li = node.parent();
                        li.html(ht.join(""));
                        ht = null;
                        InitEvent(li);
                        bindevent.call(li.find(">div"));
                    });
                }
            }
            else {
                //node not created yet
            }
        }
        String.prototype.replaceString = function (s1, s2) {
            this.str = this;
            if (s1.length == 0) return this.str;
            var idx = this.str.indexOf(s1);
            while (idx >= 0) {
                this.str = this.str.substring(0, idx) + s2 + this.str.substr(idx + s1.length);
                idx = this.str.indexOf(s1);
            }
            return this.str;
        }

        function getck(items, c, fn) {
            for (var i = 0, l = items.length; i < l; i++) {
                (items[i].showcheck == true && items[i].checkstate == 1) && c.push(fn(items[i]));
                if (items[i].ChildNodes != null && items[i].ChildNodes.length > 0) {
                    getck(items[i].ChildNodes, c, fn);
                }
            }
        }
        function getCkAndHalfCk(items, c, fn) {
            for (var i = 0, l = items.length; i < l; i++) {
                (items[i].showcheck == true && (items[i].checkstate == 1 || items[i].checkstate == 2)) && c.push(fn(items[i]));
                if (items[i].ChildNodes != null && items[i].ChildNodes.length > 0) {
                    getCkAndHalfCk(items[i].ChildNodes, c, fn);
                }
            }
        }
        me[0].t = {
            getSelectedNodes: function (gethalfchecknode) {
                var s = [];
                if (gethalfchecknode) {
                    getCkAndHalfCk(treenodes, s, function (item) { return item; });
                }
                else {
                    getck(treenodes, s, function (item) { return item; });
                }
                return s;
            },
            getSelectedValues: function () {
                var s = [];
                getck(treenodes, s, function (item) { return item.value; });
                return s;
            },
            getCurrentItem: function () {
                return dfop.citem;
            },
            reflash: function (itemOrItemId) {
                var id;
                if (typeof (itemOrItemId) == "string") {
                    id = itemOrItemId;
                }
                else {
                    id = itemOrItemId.id;
                }
                reflash(id);
            }
        };
        return me;
    };
    //get all checked nodes, and put them into array. no hierarchy
    $.fn.getCheckedNodes = function () {
        if (this[0].t) {
            return this[0].t.getSelectedValues();
        }
        return null;
    };
    $.fn.getTSNs = function (gethalfchecknode) {
        if (this[0].t) {
            return this[0].t.getSelectedNodes(gethalfchecknode);
        }
        return null;
    };
    $.fn.getCurrentNode = function () {
        if (this[0].t) {
            return this[0].t.getCurrentItem();
        }
        return null;
    };
    $.fn.reflash = function (ItemOrItemId) {
        if (this[0].t) {
            return this[0].t.reflash(ItemOrItemId);
        }
    };

})(jQuery);


text:
require 'sinatra'
require 'haml'
require 'catissue'
require 'casmall/authorization'
require 'scat/autocomplete'
require 'scat/edit'

module Scat
  # The standard Scat application error.
  class ScatError < RuntimeError; end

  class App < Sinatra::Base
    include CaSmall::Authorization, Autocomplete

    set :root, File.dirname(__FILE__) + '/..'

    if development? then
      # Don't generate fancy HTML for stack traces.
      disable :show_exceptions
      # Allow errors to get out of the app so Cucumber can display them.
      enable :raise_errors
    end

    # The authorization page name.
    set :authorization_realm, 'Please enter your username and caTissue password'

    enable :sessions

    # Displays the edit form.
    get '/' do
      haml :edit
    end

    # Saves the specimen specified in the specimen form.
    post '/' do
      # Save the specimen.
      protect! { Edit.instance.save(params.merge(:user => current_user), session) }
      # Return to the edit form.
      redirect back
    end

    # Displays the CVs for the given property attribute which match the given input
    # value term.
    get '/autocomplete/*' do |pa|
      protect! { autocomplete(pa.to_sym, params[:term]) }
    end

    # Sets the status field to the error message.
    error do
      e = env['sinatra.error']
      logger.error(e)
      request.params[:status] = e.message
      redirect back
    end
  end
end


text:
package io.github.theangrydev.businessflows;

import org.assertj.core.api.WithAssertions;
import org.junit.Test;

import java.util.List;

import static io.github.theangrydev.businessflows.PotentialFailure.failure;
import static io.github.theangrydev.businessflows.PotentialFailure.success;
import static java.lang.String.format;

public class BusinessFlowsTest implements WithAssertions {

    private class Sad {
    }

    private class Happy {

    }

    @Test
    public void getBiasThatIsPresentReturnsIt() {
        Happy expectedHappy = new Happy();

        Happy actualHappy = HappyPath.happyPath(expectedHappy)
                .get();

        assertThat(actualHappy).isSameAs(expectedHappy);
    }

    @Test
    public void getBiasThatIsNotPresentThrowsIllegalStateException() {
        Sad sad = new Sad();
        assertThatThrownBy(() -> SadPath.sadPath(sad).ifHappy().get())
            .isInstanceOf(IllegalStateException.class)
            .hasMessage(format("Not present. This is: 'Sad: %s'.", sad));
    }

    @Test
    public void orElseBiasThatIsNotPresentReturnsTheAlternative() {
        Happy expectedHappy = new Happy();
        Happy actualHappy = SadPath.<Happy, Sad>sadPath(new Sad()).ifHappy().orElse(expectedHappy);

        assertThat(actualHappy).isEqualTo(expectedHappy);
    }

    @Test
    public void orElseGetBiasThatIsNotPresentReturnsTheAlternative() {
        Happy expectedHappy = new Happy();
        Happy actualHappy = SadPath.<Happy, Sad>sadPath(new Sad()).ifHappy().orElseGet(() -> expectedHappy);

        assertThat(actualHappy).isEqualTo(expectedHappy);
    }

    @Test
    public void validateWithMultipleFailureTurnsSad() {
        Sad firstSad = new Sad();
        Sad secondSad = new Sad();

        List<Sad> actualSads = ValidationPath.validateAll(new Happy(), happy -> failure(firstSad), happy -> failure(secondSad))
                .ifSad().get();

        assertThat(actualSads).containsExactly(firstSad, secondSad);
    }

    @Test
    public void validateWithMultiplePassesStaysHappy() {
        Happy originalHappy = new Happy();

        Happy actualHappy = ValidationPath.validateAll(originalHappy, happy -> success(), happy -> success())
                .get();

        assertThat(actualHappy).isSameAs(originalHappy);
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>PSLDisjunctionImpl</title>
<meta name="date" content="2014-06-11">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.osate.xtext.aadl2.agcl.agcl.impl

Class PSLDisjunctionImpl

java.lang.Object

org.eclipse.emf.common.notify.impl.BasicNotifierImpl

org.eclipse.emf.ecore.impl.BasicEObjectImpl

org.eclipse.emf.ecore.impl.MinimalEObjectImpl

org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container

org.osate.xtext.aadl2.agcl.agcl.impl.PSLExpressionImpl

org.osate.xtext.aadl2.agcl.agcl.impl.PSLDisjunctionImpl

All Implemented Interfaces:

org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature.Internal.DynamicValueHolder, org.eclipse.emf.ecore.InternalEObject, PSLDisjunction, PSLExpression

public class PSLDisjunctionImpl
extends PSLExpressionImpl
implements PSLDisjunction

 An implementation of the model object 'PSL Disjunction'.

 The following features are implemented:

Left

Right

Nested Class Summary

Nested classes/interfaces inherited from class org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container

org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container.Dynamic

Nested classes/interfaces inherited from class org.eclipse.emf.ecore.impl.MinimalEObjectImpl

org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container

Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl

org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends java.lang.Object & org.eclipse.emf.common.notify.Adapter>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList

Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject

org.eclipse.emf.ecore.InternalEObject.EStore

Field Summary

Fields inherited from interface org.eclipse.emf.ecore.EStructuralFeature.Internal.DynamicValueHolder

NIL

Fields inherited from interface org.eclipse.emf.ecore.InternalEObject

EOPPOSITE_FEATURE_BASE

Method Summary

Methods

Modifier and Type
Method and Description

org.eclipse.emf.common.notify.NotificationChain
basicSetLeft(PSLExpression newLeft,
            org.eclipse.emf.common.notify.NotificationChain msgs)

org.eclipse.emf.common.notify.NotificationChain
basicSetRight(PSLExpression newRight,
             org.eclipse.emf.common.notify.NotificationChain msgs)

java.lang.Object
eGet(int featureID,
    boolean resolve,
    boolean coreType)

org.eclipse.emf.common.notify.NotificationChain
eInverseRemove(org.eclipse.emf.ecore.InternalEObject otherEnd,
              int featureID,
              org.eclipse.emf.common.notify.NotificationChain msgs)

boolean
eIsSet(int featureID)

void
eSet(int featureID,
    java.lang.Object newValue)

void
eUnset(int featureID)

PSLExpression
getLeft()

PSLExpression
getRight()

void
setLeft(PSLExpression newLeft)

void
setRight(PSLExpression newRight)

Methods inherited from class org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container

eInternalContainer

Methods inherited from class org.eclipse.emf.ecore.impl.MinimalEObjectImpl

dynamicGet, dynamicSet, dynamicUnset, eAdapters, eClass, eContainerFeatureID, eContents, eCrossReferences, eDeliver, eDirectResource, eIsProxy, eProxyURI, eSetClass, eSetDeliver, eSetProxyURI

Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl

eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicRemoveFromContainerFeature, eBasicSetContainer, eContainer, eContainingFeature, eContainmentFeature, eContains, eDerivedOperationID, eDerivedOperationID, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDynamicBasicRemoveFromContainer, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInvoke, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eInternalResource, eInverseAdd, eInverseAdd, eInverseRemove, eInvoke, eInvoke, eIsSet, eObjectForURIFragmentSegment, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eResolveProxy, eResource, eSet, eSetResource, eSetStore, eSetting, eStore, eUnset, eURIFragmentSegment, eVirtualGet, eVirtualGet, eVirtualIsSet, eVirtualSet, eVirtualUnset, toString

Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl

eNotificationRequired, eNotify

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Methods inherited from interface org.eclipse.emf.ecore.EObject

eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eInvoke, eIsProxy, eIsSet, eResource, eSet, eUnset

Methods inherited from interface org.eclipse.emf.common.notify.Notifier

eAdapters, eDeliver, eNotify, eSetDeliver

Methods inherited from interface org.eclipse.emf.ecore.InternalEObject

eNotificationRequired

Method Detail

getLeft

public PSLExpression getLeft()

Specified by:

getLeft in interface PSLDisjunction

Returns:

the value of the 'Left' containment reference.

See Also:

PSLDisjunction.setLeft(PSLExpression),
AgclPackage.getPSLDisjunction_Left()

basicSetLeft

public org.eclipse.emf.common.notify.NotificationChain basicSetLeft(PSLExpression newLeft,
                                                           org.eclipse.emf.common.notify.NotificationChain msgs)

setLeft

public void setLeft(PSLExpression newLeft)

Specified by:

setLeft in interface PSLDisjunction

Parameters:

newLeft - the new value of the 'Left' containment reference.

See Also:

PSLDisjunction.getLeft()

getRight

public PSLExpression getRight()

Specified by:

getRight in interface PSLDisjunction

Returns:

the value of the 'Right' containment reference.

See Also:

PSLDisjunction.setRight(PSLExpression),
AgclPackage.getPSLDisjunction_Right()

basicSetRight

public org.eclipse.emf.common.notify.NotificationChain basicSetRight(PSLExpression newRight,
                                                            org.eclipse.emf.common.notify.NotificationChain msgs)

setRight

public void setRight(PSLExpression newRight)

Specified by:

setRight in interface PSLDisjunction

Parameters:

newRight - the new value of the 'Right' containment reference.

See Also:

PSLDisjunction.getRight()

eInverseRemove

public org.eclipse.emf.common.notify.NotificationChain eInverseRemove(org.eclipse.emf.ecore.InternalEObject otherEnd,
                                                             int featureID,
                                                             org.eclipse.emf.common.notify.NotificationChain msgs)

Overrides:

eInverseRemove in class org.eclipse.emf.ecore.impl.BasicEObjectImpl

eGet

public java.lang.Object eGet(int featureID,
                    boolean resolve,
                    boolean coreType)

Specified by:

eGet in interface org.eclipse.emf.ecore.InternalEObject

Overrides:

eGet in class org.eclipse.emf.ecore.impl.BasicEObjectImpl

eSet

public void eSet(int featureID,
        java.lang.Object newValue)

Specified by:

eSet in interface org.eclipse.emf.ecore.InternalEObject

Overrides:

eSet in class org.eclipse.emf.ecore.impl.BasicEObjectImpl

eUnset

public void eUnset(int featureID)

Specified by:

eUnset in interface org.eclipse.emf.ecore.InternalEObject

Overrides:

eUnset in class org.eclipse.emf.ecore.impl.BasicEObjectImpl

eIsSet

public boolean eIsSet(int featureID)

Specified by:

eIsSet in interface org.eclipse.emf.ecore.InternalEObject

Overrides:

eIsSet in class org.eclipse.emf.ecore.impl.BasicEObjectImpl

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?php
if ( !class_exists('IamportAuthException') ) {
	class IamportAuthException extends Exception {
		public function __construct($message, $code) {
			parent::__construct($message, $code);
		}
	}
}
if ( !class_exists('IamportRequestException') ) {
	class IamportRequestException extends Exception {
		protected $response;
		public function __construct($response) {
			$this->response = $response;
			parent::__construct($response->message, $response->code);
		}
	}
}
if ( !class_exists('IamportResult') ) {
	class IamportResult {
		public $success = false;
		public $data;
		public $error;
		public function __construct($success=false, $data=null, $error=null) {
			$this->success = $success;
			$this->data = $data;
			$this->error = $error;
		}
	}
}
if ( !class_exists('IamportPayment') ) {
	class IamportPayment {
		protected $response;
		protected $custom_data;
		public function __construct($response) {
			$this->response = $response;
			$this->custom_data = json_decode($response->custom_data);
		}
		public function __get($name) {
			if (isset($this->response->{$name})) {
				return $this->response->{$name};
			}
		}
		public function getCustomData($name=null) {
			if ( is_null($name) )	return $this->custom_data;
			return $this->custom_data->{$name};
		}
	}
}
if ( !class_exists('Iamport') ) {
	class Iamport {
		const GET_TOKEN_URL = 'https://api.iamport.kr/users/getToken';
		const GET_PAYMENT_URL = 'https://api.iamport.kr/payments/';
		const FIND_PAYMENT_URL = 'https://api.iamport.kr/payments/find/';
		const CANCEL_PAYMENT_URL = 'https://api.iamport.kr/payments/cancel/';
		const SBCR_ONETIME_PAYMENT_URL = 'https://api.iamport.kr/subscribe/payments/onetime/';
		const SBCR_AGAIN_PAYMENT_URL = 'https://api.iamport.kr/subscribe/payments/again/';
		const SBCR_CUSTOMERS_URL = "https://api.iamport.kr/subscribe/customers/";
		const TOKEN_HEADER = 'Authorization';
		private $imp_key = null;
		private $imp_secret = null;
		private $access_token = null;
		private $expired_at = null;
		private $now = null;
		public function __construct($imp_key, $imp_secret) {
			$this->imp_key = $imp_key;
			$this->imp_secret = $imp_secret;
		}
		public function findByImpUID($imp_uid) {
			try {
				$response = $this->getResponse(self::GET_PAYMENT_URL.$imp_uid);

				$payment_data = new IamportPayment($response);
				return new IamportResult(true, $payment_data);
			} catch(IamportAuthException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(IamportRequestException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(Exception $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			}
		}
		public function findByMerchantUID($merchant_uid) {
			try {
				$response = $this->getResponse(self::FIND_PAYMENT_URL.$merchant_uid);

				$payment_data = new IamportPayment($response);
				return new IamportResult(true, $payment_data);
			} catch(IamportAuthException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(IamportRequestException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(Exception $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			}
		}
		public function cancel($data) {
			try {
				$access_token = $this->getAccessCode();
				$keys = array_flip(array('amount', 'reason', 'refund_holder', 'refund_bank', 'refund_account'));
				$cancel_data = array_intersect_key($data, $keys);
				if ( $data['imp_uid'] ) {
					$cancel_data['imp_uid'] = $data['imp_uid'];
				} else if ( $data['merchant_uid'] ) {
					$cancel_data['merchant_uid'] = $data['merchant_uid'];
				} else {
					return new IamportResult(false, null, array('code'=>'', 'message'=>'취소하실 imp_uid 또는 merchant_uid 중 하나를 지정하셔야 합니다.'));
				}
				$response = $this->postResponse(
					self::CANCEL_PAYMENT_URL,
					$cancel_data,
					array(self::TOKEN_HEADER.': '.$access_token)
					);
				$payment_data = new IamportPayment($response);
				return new IamportResult(true, $payment_data);
			} catch(IamportAuthException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(IamportRequestException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(Exception $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			}
		}
		public function sbcr_onetime($data) {
			try {
				$access_token = $this->getAccessCode();
				$keys = array_flip(array('token', 'merchant_uid', 'amount', 'vat', 'card_number', 'expiry', 'birth', 'pwd_2digit', 'remember_me', 'customer_uid', 'name', 'buyer_name', 'buyer_email', 'buyer_tel', 'buyer_addr', 'buyer_postcode'));
				$onetime_data = array_intersect_key($data, $keys);
				$response = $this->postResponse(
					self::SBCR_ONETIME_PAYMENT_URL,
					$onetime_data,
					array(self::TOKEN_HEADER.': '.$access_token)
					);
				$payment_data = new IamportPayment($response);
				return new IamportResult(true, $payment_data);
			} catch(IamportAuthException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(IamportRequestException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(Exception $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			}
		}
		public function sbcr_again($data) {
			try {
				$access_token = $this->getAccessCode();
				$keys = array_flip(array('token', 'customer_uid', 'merchant_uid', 'amount', 'vat', 'name', 'buyer_name', 'buyer_email', 'buyer_tel', 'buyer_addr', 'buyer_postcode'));
				$onetime_data = array_intersect_key($data, $keys);
				$response = $this->postResponse(
					self::SBCR_AGAIN_PAYMENT_URL,
					$onetime_data,
					array(self::TOKEN_HEADER.': '.$access_token)
					);
				$payment_data = new IamportPayment($response);
				return new IamportResult(true, $payment_data);
			} catch(IamportAuthException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(IamportRequestException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(Exception $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			}
		}
		// /subscribe/customers/{customer_uid} POST function
		public function sbcr_customers_POST($data) {
			try {
				$access_token = $this->getAccessCode();
				$keys = array_flip(array('customer_uid', 'card_number', 'expiry', 'birth', 'pwd_2digit'));
				$customers_data = array_intersect_key($data, $keys);
				$response = $this->postResponse(
					self::SBCR_CUSTOMERS_URL.$customers_data['customer_uid'],
					$customers_data,
					array(self::TOKEN_HEADER.': '.$access_token)
					);
				return new IamportResult(true, $response);
			} catch(IamportAuthException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(IamportRequestException $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			} catch(Exception $e) {
				return new IamportResult(false, null, array('code'=>$e->getCode(), 'message'=>$e->getMessage()));
			}
		}
		private function getResponse($request_url, $request_data=null) {
			$access_token = $this->getAccessCode();
			$headers = array(self::TOKEN_HEADER.': '.$access_token, 'Content-Type: application/json');
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, $request_url);
			curl_setopt($ch, CURLOPT_POST, false);
			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	        //execute get
			$body = curl_exec($ch);
			$error_code = curl_errno($ch);
			$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
			$r = json_decode(trim($body));
			curl_close($ch);
			if ( $error_code > 0 )	throw new Exception("Request Error(HTTP STATUS : ".$status_code.")", $error_code);
			if ( empty($r) )	throw new Exception("API서버로부터 응답이 올바르지 않습니다. ".$body, 1);
			if ( $r->code !== 0 )	throw new IamportRequestException($r);
			return $r->response;
		}
		private function postResponse($request_url, $post_data=array(), $headers=array()) {
			$post_data_str = json_encode($post_data);
			$default_header = array('Content-Type: application/json', 'Content-Length: ' . strlen($post_data_str));
			$headers = array_merge($default_header, $headers);
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, $request_url);
			curl_setopt($ch, CURLOPT_POST, true);
			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data_str);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	        //execute post
			$body = curl_exec($ch);
			$error_code = curl_errno($ch);
			$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
			$r = json_decode(trim($body));
			curl_close($ch);
			if ( $error_code > 0 )	throw new Exception("AccessCode Error(HTTP STATUS : ".$status_code.")", $error_code);
			if ( empty($r) )	throw new Exception("API서버로부터 응답이 올바르지 않습니다. ".$body, 1);
			if ( $r->code !== 0 )	throw new IamportRequestException($r);
			return $r->response;
		}
		private function getAccessCode() {
			try {
				$now = time();
				if ( $now < $this->expired_at && !empty($this->access_token) )	return $this->access_token;
				$this->expired_at = null;
				$this->access_token = null;
				$response = $this->postResponse(
					self::GET_TOKEN_URL,
					array(
						'imp_key' => $this->imp_key,
						'imp_secret' => $this->imp_secret
						)
					);
				$offset = $response->expired_at - $response->now;
				$this->expired_at = time() + $offset;
				$this->access_token = $response->access_token;
				return $response->access_token;
			} catch(Exception $e) {
				throw new IamportAuthException('[API인증오류] '.$e->getMessage(), $e->getCode());
			}
		}
	}
}

$iamport = new Iamport('7373317674987387', 'sdLNMdqKluQWtpoGXmZHnAnZggye22qufbh2pINKcDGG25nZsmHPW4PdlnrnpSRF49HtSve48VKb08at');
$result = $iamport->findByImpUID($imp_uid); //IamportResult 를 반환(success, data, error)

if ( $result->success ) {
	$payment_data = $result->data;
  return $payment_data;
  /*
	echo '## 구매자정보 출력 ##'."
";
	echo '구매자 이름 : '	.$payment_data->buyer_name."
";
	echo '구매자 전화번호 : '	.$payment_data->buyer_tel."
";
	echo '구매자 이메일 : '	.$payment_data->buyer_email."
";
	echo '구매자 우편번호 : '	.$payment_data->buyer_postcode."
";
	echo '구매자 주소 : '	.$payment_data->buyer_addr."
";
	echo '구매자 이름 : '	.$payment_data->buyer_name."
";

	echo '## 결제정보 출력 ##'."
";
	echo '가맹점 주문번호 : ' 	. $payment_data->merchant_uid."
";
	echo '결제상품 : ' 	. $payment_data->name."
";
	echo '결제상태 : ' 		. $payment_data->status."
";
	echo '결제금액 : ' 		. $payment_data->amount."
";
	echo '결제수단 : ' 		. $payment_data->pay_method."
";
	switch($payment_data->pay_method){
    case 'vbank' : echo '무통장 입금은행 : '	.$payment_data->vbank_name."
";
									 echo '무통장 예금주 : '	.$payment_data->vbank_num."
";
									 echo '무통장 계좌번호 : '	.$payment_data->vbank_num."
";
									 echo '무통장 입급기한 : '	.$payment_data->vbank_date."
";
									 break;
    case 'card' : echo '결제된 카드사명 : ' 	. $payment_data->card_name."
";
									break;
		case 'samsung' : echo '결제된 카드사명 : ' 	. $payment_data->card_name."
";
										 break;
  }
	echo '결제 매출전표 링크 : '	. $payment_data->receipt_url."
";

	echo 'Custom Data :'	. $payment_data->getCustomData('dbsals1009');
  */
} else {
	error_log($result->error['code']);
	error_log($result->error['message']);
}


text:
<?xml version="1.0" encoding="utf-8" ?>
<TaoTest xmlns="http://microsoft.com/schemas/VSLanguages/TAO">
  <InitTest>
    <StartTarget />
    <InteractiveWindow />
  </InitTest>

  <ScenarioList>

    <Scenario Name="REPL - Repeated Submission" Description="Repeated Simple Submission">
      <StartMeasure ScenarioGroup="REPL - Repeated Submission" Step="Repeated Simple Submission"/>
      <SubmitReplText>2 + 2</SubmitReplText>
      <VerifyReplOutput>4</VerifyReplOutput>
      <SendKeys>%{UP}</SendKeys>
      <ExecuteSubmission/>
      <VerifyReplOutput>4</VerifyReplOutput>
      <SendKeys>%{UP}</SendKeys>
      <ExecuteSubmission/>
      <VerifyReplOutput>4</VerifyReplOutput>
    </Scenario>

  </ScenarioList>

  <CleanupScenario>
    <StopMeasure />
  </CleanupScenario>

  <CleanupTest>
    <CloseTarget />
  </CleanupTest>
</TaoTest>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;

namespace SmoONE.UI.Layout
{
    ////ToolboxItemÓÃÓÚ¿ØÖÆÊÇ·ñÌí¼Ó×Ô¶¨Òå¿Ø¼þµ½¹¤¾ßÏ䣬trueÌí¼Ó£¬false²»Ìí¼Ó
    //[System.ComponentModel.ToolboxItem(true)]
    partial class frmAddUserLayout : Smobiler.Core.Controls.MobileUserControl
    {
        private void Check_CheckedChanged(object sender, EventArgs e)
        {

        }
    }
}


text:
import static org.junit.Assert.*;

import org.junit.Test;

public class ChainOfResponsibilityTest {

	@Test
	public void test() {
		fail("Not yet implemented");
	}

}


text:
class AddTermsAndConditionToUser < ActiveRecord::Migration
  def change
    add_column :users, :terms_and_conditions, :boolean, :default => 0

    User.update_all(:terms_and_conditions => 1)
  end
end


text:
%%LOGO%%

[Træfɪk](https://github.com/containous/traefik) is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.

Træfik integrates with your existing infrastructure components ([Docker](https://www.docker.com/), [Swarm mode](https://docs.docker.com/engine/swarm/), [Kubernetes](https://kubernetes.io), [Marathon](https://mesosphere.github.io/marathon/), [Consul](https://www.consul.io/), [Etcd](https://coreos.com/etcd/), [Rancher](https://rancher.com), [Amazon ECS](https://aws.amazon.com/ecs), ...) and configures itself automatically and dynamically.

Telling Træfik where your orchestrator is could be the *only* configuration step you need to do.

# Example usage

Grab a [sample configuration file](https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml) and rename it to `traefik.toml`. Enable `docker` provider and web UI:

```toml
################################################################
# API and dashboard configuration
################################################################
[api]
################################################################
# Docker configuration backend
################################################################
[docker]
domain = "docker.local"
watch = true
```

Start Træfɪk:

```bash
docker run -d -p 8080:8080 -p 80:80 \
-v $PWD/traefik.toml:/etc/traefik/traefik.toml \
-v /var/run/docker.sock:/var/run/docker.sock \
traefik
```

Start a backend server, named `test`:

```bash
docker run -d --name test emilevauge/whoami
```

And finally, you can access to your `whoami` server throught Træfɪk, on the domain name `{containerName}.{configuredDomain}`:

```bash
curl --header 'Host: test.docker.local' 'http://localhost:80/'
Hostname: 117c5530934d
IP: 127.0.0.1
IP: ::1
IP: 172.17.0.3
IP: fe80::42:acff:fe11:3
GET / HTTP/1.1
Host: 172.17.0.3:80
User-Agent: curl/7.35.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 172.17.0.1
X-Forwarded-Host: 172.17.0.3:80
X-Forwarded-Proto: http
X-Forwarded-Server: f2e05c433120

```

The web UI [http://localhost:8080](http://localhost:8080) will give you an overview of the frontends/backends and also a health dashboard.

![Web UI Providers](https://github.com/containous/traefik/blob/master/docs/img/web.frontend.png)

# Documentation

You can find the complete documentation at [https://docs.traefik.io](https://docs.traefik.io).

A collection of contributions around Træfik can be found at [https://awesome.traefik.io](https://awesome.traefik.io).