<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open Script Solution</title>
	<atom:link href="http://www.openscriptsolution.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.openscriptsolution.com</link>
	<description>... where solutions for script programming are found ...</description>
	<lastBuildDate>Tue, 31 Jan 2012 03:22:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to Create Breadcrumb Using the Nested Set Data Model in SQL Server</title>
		<link>http://www.openscriptsolution.com/2012/01/31/how-to-create-breadcrumb-using-the-nested-set-data-model-in-sql-server/</link>
		<comments>http://www.openscriptsolution.com/2012/01/31/how-to-create-breadcrumb-using-the-nested-set-data-model-in-sql-server/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 03:19:46 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[basis data]]></category>
		<category><![CDATA[breadcrumb]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[konversi]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Stored Procedure]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1501</guid>
		<description><![CDATA[Still remember the similar article I wrote regarding the title of this article? Well, if you want to implement breadcrumb using the SQL Server database, then here is the related Stored Procedures in SQL Server format. In other words, this following article will show you the same Stored Procedures in SQL Server instead of using [...]]]></description>
			<content:encoded><![CDATA[<p>Still remember the <a href="http://www.openscriptsolution.com/2011/12/05/how-to-create-breadcrumb-using-the-nested-set-data-model-in-mysql/" title="How to Create Breadcrumb Using the Nested Set Data Model in MySQL" target="_blank">similar article</a> I wrote regarding the title of this article? Well, if you want to implement breadcrumb using the SQL Server database, then here is the related Stored Procedures in SQL Server format. In other words, this following article will show you the same Stored Procedures in SQL Server instead of using MySQL database. This is very useful if you want to switch your database from MySQL to SQL Server for your web application, so you don&#8217;t have to waste your time to convert the Stored Procedures in MySQL to SQL Server format. Simply use the following three Stored Procedures that I has successfully converted it to SQL Server. I have had tested those three SPs in SQL Server, and made sure that everything went smoothly.</p>
<ol>
<li>
<h2>Inserting New Breadcrumb</h2>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">PROCEDURE</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>addnewbreadcrumb<span style="color: #66cc66;">&#93;</span>
  @PageTitleParent <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	@PageTitle <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	@PageURL <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #993333; font-weight: bold;">BEGIN</span>
<span style="color: #993333; font-weight: bold;">DECLARE</span> @ParentLevel <span style="color: #993333; font-weight: bold;">INTEGER</span>;
<span style="color: #993333; font-weight: bold;">DECLARE</span> @RecCount <span style="color: #993333; font-weight: bold;">INTEGER</span>;
<span style="color: #993333; font-weight: bold;">DECLARE</span> @CheckRecCount <span style="color: #993333; font-weight: bold;">INTEGER</span>;
<span style="color: #993333; font-weight: bold;">DECLARE</span> @MyPageTitle <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #808080; font-style: italic;">-- routine body goes here, e.g.</span>
<span style="color: #993333; font-weight: bold;">SET</span> @ParentLevel <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> Rgt <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> 
Page_Title <span style="color: #66cc66;">=</span> @PageTitleParent<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">SET</span> @CheckRecCount <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">COUNT</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> RecordCount <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> 
Page_Title <span style="color: #66cc66;">=</span> @PageTitle<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #993333; font-weight: bold;">IF</span> @CheckRecCount <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span>
  <span style="color: #993333; font-weight: bold;">BEGIN</span> 
		<span style="color: #993333; font-weight: bold;">SET</span> @MyPageTitle <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'The following Page_Title is already exists in database: '</span> <span style="color: #66cc66;">+</span>  @PageTitle;
		<span style="color: #993333; font-weight: bold;">SELECT</span> @MyPageTitle;
		<span style="color: #993333; font-weight: bold;">GOTO</span> GoodBye;
  <span style="color: #993333; font-weight: bold;">END</span>
&nbsp;
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span> 
   <span style="color: #993333; font-weight: bold;">SET</span> Lft <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">CASE</span> <span style="color: #993333; font-weight: bold;">WHEN</span> Lft <span style="color: #66cc66;">&gt;</span> @ParentLevel <span style="color: #993333; font-weight: bold;">THEN</span>
      Lft <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">2</span>
    <span style="color: #993333; font-weight: bold;">ELSE</span>
      Lft <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">0</span>
    <span style="color: #993333; font-weight: bold;">END</span><span style="color: #66cc66;">,</span>
   Rgt <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">CASE</span> <span style="color: #993333; font-weight: bold;">WHEN</span> Rgt <span style="color: #66cc66;">&gt;=</span> @ParentLevel <span style="color: #993333; font-weight: bold;">THEN</span>
      Rgt <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">2</span>
   <span style="color: #993333; font-weight: bold;">ELSE</span>
      Rgt <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">0</span>
   <span style="color: #993333; font-weight: bold;">END</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  Rgt <span style="color: #66cc66;">&gt;=</span> @ParentLevel;
&nbsp;
<span style="color: #993333; font-weight: bold;">SET</span> @RecCount <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">COUNT</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #993333; font-weight: bold;">IF</span> @RecCount <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>
    <span style="color: #993333; font-weight: bold;">BEGIN</span>
		<span style="color: #808080; font-style: italic;">-- this is for handling the first record</span>
		<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#40;</span>Page_Title<span style="color: #66cc66;">,</span> Page_URL<span style="color: #66cc66;">,</span> Lft<span style="color: #66cc66;">,</span> Rgt<span style="color: #66cc66;">&#41;</span>
					<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span>@PageTitle<span style="color: #66cc66;">,</span> @PageURL<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #993333; font-weight: bold;">END</span>
	<span style="color: #993333; font-weight: bold;">ELSE</span>
    <span style="color: #993333; font-weight: bold;">BEGIN</span>
		<span style="color: #808080; font-style: italic;">-- whereas the following is for the second record, and so forth!</span>
		<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#40;</span>Page_Title<span style="color: #66cc66;">,</span> Page_URL<span style="color: #66cc66;">,</span> Lft<span style="color: #66cc66;">,</span> Rgt<span style="color: #66cc66;">&#41;</span>
					<span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span>@PageTitle<span style="color: #66cc66;">,</span> @PageURL<span style="color: #66cc66;">,</span> @ParentLevel<span style="color: #66cc66;">,</span> <span style="color: #66cc66;">&#40;</span>@ParentLevel <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	  <span style="color: #993333; font-weight: bold;">END</span>
&nbsp;
  GoodBye:
&nbsp;
<span style="color: #993333; font-weight: bold;">END</span>
<span style="color: #993333; font-weight: bold;">GO</span></pre></div></div>

</li>
<li>
<h2>Removing or Deleting Breadcrumb</h2>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">PROCEDURE</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>deletebreadcrumbbasedonpagetitle<span style="color: #66cc66;">&#93;</span>
  @PageTitle <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #993333; font-weight: bold;">BEGIN</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">DECLARE</span> @DeletedPageTitle <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">DECLARE</span> @DeletedLft <span style="color: #993333; font-weight: bold;">INTEGER</span>;
<span style="color: #993333; font-weight: bold;">DECLARE</span> @DeletedRgt <span style="color: #993333; font-weight: bold;">INTEGER</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> @DeletedPageTitle<span style="color: #66cc66;">=</span>Page_Title<span style="color: #66cc66;">,</span> @DeletedLft<span style="color: #66cc66;">=</span>Lft<span style="color: #66cc66;">,</span> @DeletedRgt<span style="color: #66cc66;">=</span>Rgt
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span> 
<span style="color: #993333; font-weight: bold;">WHERE</span>  Page_Title <span style="color: #66cc66;">=</span> @PageTitle;
&nbsp;
<span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span>
<span style="color: #993333; font-weight: bold;">WHERE</span> Lft <span style="color: #993333; font-weight: bold;">BETWEEN</span> @DeletedLft <span style="color: #993333; font-weight: bold;">AND</span> @DeletedRgt;
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>breadcrumblinks<span style="color: #66cc66;">&#93;</span>
   <span style="color: #993333; font-weight: bold;">SET</span> Lft <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">CASE</span> <span style="color: #993333; font-weight: bold;">WHEN</span> Lft <span style="color: #66cc66;">&gt;</span> @DeletedLft <span style="color: #993333; font-weight: bold;">THEN</span>
             Lft <span style="color: #66cc66;">-</span> <span style="color: #66cc66;">&#40;</span>@DeletedRgt <span style="color: #66cc66;">-</span> @DeletedLft <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
          <span style="color: #993333; font-weight: bold;">ELSE</span>
             Lft
          <span style="color: #993333; font-weight: bold;">END</span><span style="color: #66cc66;">,</span>
       Rgt <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">CASE</span> <span style="color: #993333; font-weight: bold;">WHEN</span> Rgt <span style="color: #66cc66;">&gt;</span> @DeletedLft <span style="color: #993333; font-weight: bold;">THEN</span>
             Rgt <span style="color: #66cc66;">-</span> <span style="color: #66cc66;">&#40;</span>@DeletedRgt <span style="color: #66cc66;">-</span> @DeletedLft <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
          <span style="color: #993333; font-weight: bold;">ELSE</span>
             Rgt
          <span style="color: #993333; font-weight: bold;">END</span>
   <span style="color: #993333; font-weight: bold;">WHERE</span> Lft <span style="color: #66cc66;">&gt;</span> @DeletedLft
      <span style="color: #993333; font-weight: bold;">OR</span> Rgt <span style="color: #66cc66;">&gt;</span> @DeletedLft;
<span style="color: #993333; font-weight: bold;">END</span>
<span style="color: #993333; font-weight: bold;">GO</span></pre></div></div>

</li>
<li>
<h2>Moving Breadcrumb to Another Parent</h2>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">PROCEDURE</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#91;</span>movebreadcrumb<span style="color: #66cc66;">&#93;</span>
  @CurrentRoot <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	@NewParent <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #993333; font-weight: bold;">BEGIN</span>
  <span style="color: #808080; font-style: italic;">-- routine body goes here, e.g.</span>
  <span style="color: #993333; font-weight: bold;">DECLARE</span> @Origin_Lft <span style="color: #993333; font-weight: bold;">INTEGER</span>;
	<span style="color: #993333; font-weight: bold;">DECLARE</span> @Origin_Rgt <span style="color: #993333; font-weight: bold;">INTEGER</span>;
	<span style="color: #993333; font-weight: bold;">DECLARE</span> @NewParent_Rgt <span style="color: #993333; font-weight: bold;">INTEGER</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> @Origin_Lft<span style="color: #66cc66;">=</span>Lft<span style="color: #66cc66;">,</span> @Origin_Rgt<span style="color: #66cc66;">=</span>Rgt
	<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span>breadcrumblinks 
	<span style="color: #993333; font-weight: bold;">WHERE</span> Page_Title <span style="color: #66cc66;">=</span> @CurrentRoot;
<span style="color: #993333; font-weight: bold;">SET</span> @NewParent_Rgt <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> Rgt <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span>breadcrumblinks
	<span style="color: #993333; font-weight: bold;">WHERE</span> Page_Title <span style="color: #66cc66;">=</span> @NewParent<span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #66cc66;">&#91;</span>dbo<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">.</span>breadcrumblinks 
	<span style="color: #993333; font-weight: bold;">SET</span> Lft <span style="color: #66cc66;">=</span> Lft <span style="color: #66cc66;">+</span> 
	<span style="color: #993333; font-weight: bold;">CASE</span>
		<span style="color: #993333; font-weight: bold;">WHEN</span> @NewParent_Rgt <span style="color: #66cc66;">&lt;</span> @Origin_Lft
			<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #993333; font-weight: bold;">CASE</span>
				<span style="color: #993333; font-weight: bold;">WHEN</span> Lft <span style="color: #993333; font-weight: bold;">BETWEEN</span> @Origin_Lft <span style="color: #993333; font-weight: bold;">AND</span> @Origin_Rgt
					<span style="color: #993333; font-weight: bold;">THEN</span> @NewParent_Rgt <span style="color: #66cc66;">-</span> @Origin_Lft
				<span style="color: #993333; font-weight: bold;">WHEN</span> Lft <span style="color: #993333; font-weight: bold;">BETWEEN</span> @NewParent_Rgt	<span style="color: #993333; font-weight: bold;">AND</span> @Origin_Lft <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>
					<span style="color: #993333; font-weight: bold;">THEN</span> @Origin_Rgt <span style="color: #66cc66;">-</span> @Origin_Lft <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span>
				<span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">END</span>
		<span style="color: #993333; font-weight: bold;">WHEN</span> @NewParent_Rgt <span style="color: #66cc66;">&gt;</span> @Origin_Rgt
			<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #993333; font-weight: bold;">CASE</span>
				<span style="color: #993333; font-weight: bold;">WHEN</span> Lft <span style="color: #993333; font-weight: bold;">BETWEEN</span> @Origin_Lft	<span style="color: #993333; font-weight: bold;">AND</span> @Origin_Rgt
					<span style="color: #993333; font-weight: bold;">THEN</span> @NewParent_Rgt <span style="color: #66cc66;">-</span> @Origin_Rgt <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>
				<span style="color: #993333; font-weight: bold;">WHEN</span> Lft <span style="color: #993333; font-weight: bold;">BETWEEN</span> @Origin_Rgt <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">AND</span> @NewParent_Rgt <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>
					<span style="color: #993333; font-weight: bold;">THEN</span> @Origin_Lft <span style="color: #66cc66;">-</span> @Origin_Rgt <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>
				<span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">END</span>
			<span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">END</span><span style="color: #66cc66;">,</span>
	Rgt <span style="color: #66cc66;">=</span> Rgt <span style="color: #66cc66;">+</span> 
	<span style="color: #993333; font-weight: bold;">CASE</span>
		<span style="color: #993333; font-weight: bold;">WHEN</span> @NewParent_Rgt <span style="color: #66cc66;">&lt;</span> @Origin_Lft
			<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #993333; font-weight: bold;">CASE</span>
		<span style="color: #993333; font-weight: bold;">WHEN</span> Rgt <span style="color: #993333; font-weight: bold;">BETWEEN</span> @Origin_Lft <span style="color: #993333; font-weight: bold;">AND</span> @Origin_Rgt
			<span style="color: #993333; font-weight: bold;">THEN</span> @NewParent_Rgt <span style="color: #66cc66;">-</span> @Origin_Lft
		<span style="color: #993333; font-weight: bold;">WHEN</span> Rgt <span style="color: #993333; font-weight: bold;">BETWEEN</span> @NewParent_Rgt <span style="color: #993333; font-weight: bold;">AND</span> @Origin_Lft <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>
			<span style="color: #993333; font-weight: bold;">THEN</span> @Origin_Rgt <span style="color: #66cc66;">-</span> @Origin_Lft <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span>
		<span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">END</span>
		<span style="color: #993333; font-weight: bold;">WHEN</span> @NewParent_Rgt <span style="color: #66cc66;">&gt;</span> @Origin_Rgt
			<span style="color: #993333; font-weight: bold;">THEN</span> <span style="color: #993333; font-weight: bold;">CASE</span>
				<span style="color: #993333; font-weight: bold;">WHEN</span> Rgt <span style="color: #993333; font-weight: bold;">BETWEEN</span> @Origin_Lft <span style="color: #993333; font-weight: bold;">AND</span> @Origin_Rgt
					<span style="color: #993333; font-weight: bold;">THEN</span> @NewParent_Rgt <span style="color: #66cc66;">-</span> @Origin_Rgt <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>
				<span style="color: #993333; font-weight: bold;">WHEN</span> Rgt <span style="color: #993333; font-weight: bold;">BETWEEN</span> @Origin_Rgt <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span>	<span style="color: #993333; font-weight: bold;">AND</span> @NewParent_Rgt <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>
					<span style="color: #993333; font-weight: bold;">THEN</span> @Origin_Lft <span style="color: #66cc66;">-</span> @Origin_Rgt <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span>
				<span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">END</span>
			<span style="color: #993333; font-weight: bold;">ELSE</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">END</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">END</span>
<span style="color: #993333; font-weight: bold;">GO</span></pre></div></div>

</li>
</ol>
<p>Hope it helps!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2012%2F01%2F31%2Fhow-to-create-breadcrumb-using-the-nested-set-data-model-in-sql-server%2F&amp;title=How%20to%20Create%20Breadcrumb%20Using%20the%20Nested%20Set%20Data%20Model%20in%20SQL%20Server" id="wpa2a_2"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2012/01/31/how-to-create-breadcrumb-using-the-nested-set-data-model-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Create 3 New Permissions (Can Post Reply, Can Post Internal Notes, and Can Assign Tickets) into osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2012/01/20/how-to-create-3-new-permissions-can-post-reply-can-post-internal-notes-and-can-assign-tickets-into-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2012/01/20/how-to-create-3-new-permissions-can-post-reply-can-post-internal-notes-and-can-assign-tickets-into-osticket-1-6-st/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 04:19:53 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[assign tickets]]></category>
		<category><![CDATA[post internal notes]]></category>
		<category><![CDATA[post reply]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[staff panel]]></category>
		<category><![CDATA[staff-side]]></category>
		<category><![CDATA[user groups]]></category>
		<category><![CDATA[v1.6 ST]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1495</guid>
		<description><![CDATA[osTicket does very good job to restrict the certain permissions to the staff by implementing the User Groups feature. There are seven permissions that have been provided in the User Groups. They are: Can Create Tickets, Can Edit Tickets, Can Close Tickets, Can Transfer Tickets, Can Delete Tickets, Can Ban Emails, and Can Manage Premade. [...]]]></description>
			<content:encoded><![CDATA[<p>osTicket does very good job to restrict the certain permissions to the staff by implementing the User Groups feature. There are seven permissions that have been provided in the User Groups. They are: Can Create Tickets, Can Edit Tickets, Can Close Tickets, Can Transfer Tickets, Can Delete Tickets, Can Ban Emails, and Can Manage Premade. Unfortunately, up to osTicket version 1.6 ST, there are no permissions for the following action: Can Post Reply, Can Post Internal Notes, and Can Assign Tickets. In this article, I will show you how you can add those three new permissions into the User Groups feature. They are very useful whenever you want to create a User Group and then assign it to the certain users which do not have the abilities for that three new permissions. By default, these three new permissions are all set to 1 (Enabled). If you want to change the values or disable those three new permissions, then you have to login as Administrator, and then go to Admin Panel -> Staff -> User Groups, then edit a user group record from the list which you want to disable them.</p>
<ol>
<li>
First of all, alter your <strong>ost_groups</strong> table by adding the three new fields called by using the following script into your osTicket database (please adjust the table prefix if you are using the different one with mine using <strong>ost_</strong>):</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`ost_groups`</span> <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> <span style="color: #ff0000;">`can_post_reply`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #cc66cc;">1</span> AFTER <span style="color: #ff0000;">`can_create_tickets`</span>;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`ost_groups`</span> <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> <span style="color: #ff0000;">`can_post_internal_notes`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #cc66cc;">1</span> AFTER <span style="color: #ff0000;">`can_post_reply`</span>;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`ost_groups`</span> <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> <span style="color: #ff0000;">`can_assign_tickets`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #cc66cc;">1</span> AFTER <span style="color: #ff0000;">`can_post_internal_notes`</span>;</pre></div></div>

</li>
<li>
Open your <strong>/include/staff/group.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        &lt;tr&gt;&lt;th&gt;Can &lt;b&gt;Create&lt;/b&gt; Tickets&lt;/th&gt;
            &lt;td&gt;
                &lt;input type=&quot;radio&quot; name=&quot;can_create_tickets&quot;  value=&quot;1&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Yes 
                &lt;input type=&quot;radio&quot; name=&quot;can_create_tickets&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;No
                &amp;nbsp;&amp;nbsp;&lt;i&gt;Ability to open tickets on behalf of users!&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;</pre></div></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
        <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Can <span style="color: #339933;">&lt;</span>b<span style="color: #339933;">&gt;</span>Post Reply<span style="color: #339933;">&lt;/</span>b<span style="color: #339933;">&gt;&lt;/</span>th<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;can_post_reply&quot;</span>  value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span>   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_reply'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Yes 
                &lt;input type=&quot;radio&quot; name=&quot;can_post_reply&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_reply'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;No
                &amp;nbsp;&amp;nbsp;&lt;i&gt;Ability to post replies!&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;th&gt;Can &lt;b&gt;Post Internal Notes&lt;/b&gt;&lt;/th&gt;
            &lt;td&gt;
                &lt;input type=&quot;radio&quot; name=&quot;can_post_internal_notes&quot;  value=&quot;1&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_internal_notes'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Yes 
                &lt;input type=&quot;radio&quot; name=&quot;can_post_internal_notes&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_internal_notes'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;No
                &amp;nbsp;&amp;nbsp;&lt;i&gt;Ability to post Internal Notes!&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;th&gt;Can &lt;b&gt;Assign&lt;/b&gt; Tickets&lt;/th&gt;
            &lt;td&gt;
                &lt;input type=&quot;radio&quot; name=&quot;can_assign_tickets&quot;  value=&quot;1&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_assign_tickets'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Yes 
                &lt;input type=&quot;radio&quot; name=&quot;can_assign_tickets&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_assign_tickets'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;No
                &amp;nbsp;&amp;nbsp;&lt;i&gt;Ability to assign tickets!&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Open your <strong>/include/class.group.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">', can_create_tickets='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></div></div>

<p>then replace it with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">', can_create_tickets='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012</span>
				 <span style="color: #0000ff;">', can_post_reply='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_reply'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
				 <span style="color: #0000ff;">', can_post_internal_notes='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_internal_notes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>				 
				 <span style="color: #0000ff;">', can_assign_tickets='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_assign_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012</span></pre></div></div>

</li>
<li>
Open your <strong>/include/class.staff.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> canCreateTickets<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">udata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012</span>
    <span style="color: #000000; font-weight: bold;">function</span> canPostReply<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">udata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_reply'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>    
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> canPostInternalNotes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">udata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_internal_notes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>    
    <span style="color: #009900;">&#125;</span>	
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> canAssignTickets<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">udata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_assign_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>    
    <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012</span></pre></div></div>

</li>
<li>
Open your <strong>/include/staff/viewticket.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;reply&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabbertab&quot;</span> align<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;left&quot;</span><span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Post Reply<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span></pre></div></div>

<p>before the first line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canPostReply</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                        <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
                            <span style="color: #339933;">&lt;</span>div  style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;margin-left: 50px; margin-top: 30px; margin-bottom: 10px;border: 0px;&quot;</span><span style="color: #339933;">&gt;</span>
                                <span style="color: #339933;">&lt;</span>input <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">'submit'</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">'Post Reply'</span> <span style="color: #339933;">/&gt;</span>
                                <span style="color: #339933;">&lt;</span>input <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">'reset'</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">'Reset'</span> <span style="color: #339933;">/&gt;</span>
                                <span style="color: #339933;">&lt;</span>input <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">'button'</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">'Cancel'</span> onClick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;history.go(-1)&quot;</span> <span style="color: #339933;">/&gt;</span>
                            <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
                    <span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span>                
                <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;notes&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabbertab&quot;</span>  align<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;left&quot;</span><span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Post Internal Note<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span></pre></div></div>

<p>before the first line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canPostInternalNotes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                        &lt;div style=&quot;margin-top: 3px;&quot;&gt;
                            &lt;b&gt;Ticket Status:&lt;/b&gt;
                            <span style="color: #000000; font-weight: bold;">&lt;?</span>
                            <span style="color: #000088;">$checked</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//not selected by default.</span>
                            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isOpen</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                            &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;ticket_status&quot; id=&quot;ticket_status&quot; value=&quot;Close&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$checked</span><span style="color: #000000; font-weight: bold;">?&gt;</span> &gt; Close Ticket&lt;/label&gt;
                            <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                            &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;ticket_status&quot; id=&quot;ticket_status&quot; value=&quot;Reopen&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$checked</span><span style="color: #000000; font-weight: bold;">?&gt;</span> &gt; Reopen Ticket&lt;/label&gt;
                            <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                        &lt;/div&gt;
                        <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                        &lt;p&gt;
                            &lt;div  align=&quot;left&quot; style=&quot;margin-left: 50px;margin-top: 10px; margin-bottom: 10px;border: 0px;&quot;&gt;
                                &lt;input class=&quot;button&quot; type='submit' value='Submit' /&gt;
                                &lt;input class=&quot;button&quot; type='reset' value='Reset' /&gt;
                                &lt;input class=&quot;button&quot; type='button' value='Cancel' onClick=&quot;history.go(-1)&quot; /&gt;
                            &lt;/div&gt;
                        &lt;/p&gt;
                    &lt;/form&gt;
                &lt;/p&gt;
            &lt;/div&gt;</pre></div></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #000000; font-weight: bold;">&lt;?</span>
             <span style="color: #666666; font-style: italic;">//When the ticket is assigned Allow assignee, admin or ANY dept manager to reassign the ticket.</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAssigned</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>  <span style="color: #339933;">||</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStaffId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                 <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;div id=&quot;assign&quot; class=&quot;tabbertab&quot;  align=&quot;left&quot;&gt;
&nbsp;
                &lt;h2&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$staff</span>?<span style="color: #0000ff;">'Re Assign Ticket'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'Assign to Staff'</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;</pre></div></div>

<p>before the first line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canAssignTickets</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                        &lt;p&gt;
                            &lt;div  style=&quot;margin-left: 50px; margin-top: 5px; margin-bottom: 10px;border: 0px;&quot; align=&quot;left&quot;&gt;
                                &lt;input class=&quot;button&quot; type='submit' value='Assign' /&gt;
                                &lt;input class=&quot;button&quot; type='reset' value='Reset' /&gt;
                                &lt;input class=&quot;button&quot; type='button' value='Cancel' onClick=&quot;history.go(-1)&quot; /&gt;
                            &lt;/div&gt;
                        &lt;/p&gt;
                    &lt;/form&gt;
                &lt;/p&gt;
            &lt;/div&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
</ol>
<p>Hopefully you find it useful. <img src='http://www.openscriptsolution.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2012%2F01%2F20%2Fhow-to-create-3-new-permissions-can-post-reply-can-post-internal-notes-and-can-assign-tickets-into-osticket-1-6-st%2F&amp;title=How%20to%20Create%203%20New%20Permissions%20%28Can%20Post%20Reply%2C%20Can%20Post%20Internal%20Notes%2C%20and%20Can%20Assign%20Tickets%29%20into%20osTicket%201.6%20ST" id="wpa2a_4"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2012/01/20/how-to-create-3-new-permissions-can-post-reply-can-post-internal-notes-and-can-assign-tickets-into-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Create Breadcrumb Using the Nested Set Data Model in MySQL</title>
		<link>http://www.openscriptsolution.com/2011/12/05/how-to-create-breadcrumb-using-the-nested-set-data-model-in-mysql/</link>
		<comments>http://www.openscriptsolution.com/2011/12/05/how-to-create-breadcrumb-using-the-nested-set-data-model-in-mysql/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 06:32:59 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Adjacency List Model]]></category>
		<category><![CDATA[Hierarchical Data Model]]></category>
		<category><![CDATA[Model Data Hirarki]]></category>
		<category><![CDATA[Nested Set Data Model]]></category>
		<category><![CDATA[Stored Procedure]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1480</guid>
		<description><![CDATA[There are so many articles in the Internet have explained us that the Nested Set Data Model has many advantages (although it is more complex among the others) for handling the Hierarchical Data Model. Some of the advantages of this Nested Set Data Model are: You can create unlimited levels and it only needs one [...]]]></description>
			<content:encoded><![CDATA[<p>There are so many articles in the Internet have explained us that the Nested Set Data Model has many advantages (although it is more complex among the others) for handling the Hierarchical Data Model. </p>
<p>Some of the advantages of this Nested Set Data Model are: </p>
<ol>
<li>You can create unlimited levels and it only needs one query to get all the related path.</li>
<li>Since it only need one query, then it is faster to get and display the full path.</li>
<li>It is easy to manage the records (inserting, deleting, and moving record). We will focus on this item in this article using MySQL database.</li>
</ol>
<p>The only one disadvantage of this model is it is more complex than the others. You have to be careful to manage all of the records (inserting, deleting, and moving), otherwise you will break all of the breadcrumb records!</p>
<p>I came across the following article: <a href="http://www.developer.com/db/article.php/3517366/Using-the-Nested-Set-Data-Model-for-Breadcrumb-Links.htm" title="Using the Nested Set Data Model for Breadcrumb Links" target="_blank">Using the Nested Set Data Model for Breadcrumb Links</a> and I think this is the smartest way how you can create the independent breadcrumb for any websites which have not implemented it. Since that article only explained how to add and delete a row (breadcrumb), but had not explained more detail how can you move the certain breadcrumb from the current position to the new parent, then in this article I wrote, I will try to explain you step by step, how you can create the Stored Procedures in MySQL for inserting new breadcrumb, deleting breadcrumbs based on their parent, and also: <strong>Moving the Breadcrumb</strong> from the current location to the new parent. This will be helpful to manage your breadcrumb easily and quickly especially if the current location has many breadcrumb childs. If you do not handle this carefully then you will destroy all of your breadcrumb records in your table. </p>
<ol>
<li>
<h2>Creating Table for Breadcrumb</h2>
<p>First of all, let&#8217;s create a table which we will use to store all the breadcrumb records using the following SQL query:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #FF00FF;">&#40;</span>
  <span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>URL`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`Lft`</span> <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">4</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`Rgt`</span> <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">4</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">ENGINE</span><span style="color: #CC0099;">=</span>MyISAM <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF9900; font-weight: bold;">CHARSET</span><span style="color: #CC0099;">=</span>utf8<span style="color: #000033;">;</span></pre></div></div>

</li>
<li>
<h2>Inserting New Breadcrumb</h2>
<p>Now let&#8217;s create a Stored Procedure for adding a new record to your breadcrumblinks table above:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">PROCEDURE</span> <span style="color: #008000;">`addnewbreadcrumb`</span><span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">IN</span> PageTitleParent <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> 
                                    PageTitle <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> 
                                    PageURL <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span>
GoodBye: <span style="color: #990099; font-weight: bold;">BEGIN</span>
<span style="color: #808080; font-style: italic;">-- Need three parameters (PageTitleParent, PageTitle, and PageURL), </span>
<span style="color: #808080; font-style: italic;">-- look at this line --&gt; `Page_Title` = PageTitleParent);</span>
<span style="color: #808080; font-style: italic;">-- look at this line --&gt; VALUES (PageTitle, PageURL, ParentLevel, (ParentLevel + 1));</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> ParentLevel <span style="color: #999900; font-weight: bold;">INTEGER</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> RecCount <span style="color: #999900; font-weight: bold;">INTEGER</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> CheckRecCount <span style="color: #999900; font-weight: bold;">INTEGER</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> MyPageTitle <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">SET</span> ParentLevel <span style="color: #CC0099;">=</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">SELECT</span> Rgt <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #990099; font-weight: bold;">WHERE</span> 
<span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span> <span style="color: #CC0099;">=</span> PageTitleParent<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">SET</span> CheckRecCount <span style="color: #CC0099;">=</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #000099;">COUNT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #CC0099;">*</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">AS</span> RecCount <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #990099; font-weight: bold;">WHERE</span> 
<span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span> <span style="color: #CC0099;">=</span> PageTitle<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
	<span style="color: #009900;">IF</span> CheckRecCount <span style="color: #CC0099;">&gt;</span> <span style="color: #008080;">0</span> <span style="color: #009900;">THEN</span>
		<span style="color: #990099; font-weight: bold;">SET</span> MyPageTitle <span style="color: #CC0099;">=</span> <span style="color: #000099;">CONCAT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;The following Page<span style="color: #008080; font-weight: bold;">_</span>Title is already exists in database: &quot;</span><span style="color: #000033;">,</span> PageTitle<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
		<span style="color: #990099; font-weight: bold;">SELECT</span> MyPageTitle<span style="color: #000033;">;</span>
		LEAVE GoodBye<span style="color: #000033;">;</span>
  <span style="color: #009900;">END</span> <span style="color: #009900;">IF</span><span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">UPDATE</span> <span style="color: #008000;">`breadcrumblinks`</span>
   <span style="color: #990099; font-weight: bold;">SET</span> Lft <span style="color: #CC0099;">=</span> <span style="color: #009900;">CASE</span> <span style="color: #009900;">WHEN</span> Lft <span style="color: #CC0099;">&gt;</span> ParentLevel <span style="color: #009900;">THEN</span>
      Lft <span style="color: #CC0099;">+</span> <span style="color: #008080;">2</span>
    <span style="color: #009900;">ELSE</span>
      Lft <span style="color: #CC0099;">+</span> <span style="color: #008080;">0</span>
    <span style="color: #009900;">END</span><span style="color: #000033;">,</span>
   Rgt <span style="color: #CC0099;">=</span> <span style="color: #009900;">CASE</span> <span style="color: #009900;">WHEN</span> Rgt <span style="color: #CC0099;">&gt;=</span> ParentLevel <span style="color: #009900;">THEN</span>
      Rgt <span style="color: #CC0099;">+</span> <span style="color: #008080;">2</span>
   <span style="color: #009900;">ELSE</span>
      Rgt <span style="color: #CC0099;">+</span> <span style="color: #008080;">0</span>
   <span style="color: #009900;">END</span>
<span style="color: #990099; font-weight: bold;">WHERE</span>  Rgt <span style="color: #CC0099;">&gt;=</span> ParentLevel<span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">SET</span> RecCount <span style="color: #CC0099;">=</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #000099;">COUNT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #CC0099;">*</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
	<span style="color: #009900;">IF</span> RecCount <span style="color: #CC0099;">=</span> <span style="color: #008080;">0</span> <span style="color: #009900;">THEN</span>
		<span style="color: #808080; font-style: italic;">-- this is for handling the first record</span>
		<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #FF00FF;">&#40;</span>Page_Title<span style="color: #000033;">,</span> Page_URL<span style="color: #000033;">,</span> Lft<span style="color: #000033;">,</span> Rgt<span style="color: #FF00FF;">&#41;</span>
					<span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span>PageTitle<span style="color: #000033;">,</span> PageURL<span style="color: #000033;">,</span> <span style="color: #008080;">1</span><span style="color: #000033;">,</span> <span style="color: #008080;">2</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
	<span style="color: #009900;">ELSE</span>
		<span style="color: #808080; font-style: italic;">-- whereas the following is for the second record, and so forth!</span>
		<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #FF00FF;">&#40;</span>Page_Title<span style="color: #000033;">,</span> Page_URL<span style="color: #000033;">,</span> Lft<span style="color: #000033;">,</span> Rgt<span style="color: #FF00FF;">&#41;</span>
					<span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span>PageTitle<span style="color: #000033;">,</span> PageURL<span style="color: #000033;">,</span> ParentLevel<span style="color: #000033;">,</span> <span style="color: #FF00FF;">&#40;</span>ParentLevel <span style="color: #CC0099;">+</span> <span style="color: #008080;">1</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
	<span style="color: #009900;">END</span> <span style="color: #009900;">IF</span><span style="color: #000033;">;</span>
&nbsp;
<span style="color: #009900;">END</span></pre></div></div>

<p>Now let&#8217;s discuss that Stored Procedure (SP) above:<br />
Look at this following line:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">PROCEDURE</span> <span style="color: #008000;">`addnewbreadcrumb`</span><span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">IN</span> PageTitleParent <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> 
                                    PageTitle <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> 
                                    PageURL <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>We see that this SP has a name: <strong>addnewbreadcrumb</strong>, and it needs three parameters.<br />
They are:<br />
- <strong>PageTitleParent</strong>: This parameter is the page title parent of your new breadcrumb,<br />
- <strong>PageTitle</strong>: This parameter is the page title of your new breadcrumb,<br />
- <strong>PageURL</strong>: This parameter is the page URL of your new breadcrumb.</p>
<p>Here is how we can keep the <strong>ParentLevel</strong> value based on the <strong>PageTitleParent</strong> parameter using this following SQL:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SET</span> ParentLevel <span style="color: #CC0099;">=</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">SELECT</span> Rgt <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #990099; font-weight: bold;">WHERE</span> 
<span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span> <span style="color: #CC0099;">=</span> PageTitleParent<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div>

<p>Before we add a new breadcrumb record, let&#8217;s check to the table whether the new record that we will insert has already exists or not using this following code (this is important in order to avoid the summing up the value of Lft and Rgt of the breadcrumb):</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SET</span> CheckRecCount <span style="color: #CC0099;">=</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #000099;">COUNT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #CC0099;">*</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">AS</span> RecCount <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcru.mblinks`</span> <span style="color: #990099; font-weight: bold;">WHERE</span> 
<span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span> <span style="color: #CC0099;">=</span> PageTitle<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
	<span style="color: #009900;">IF</span> CheckRecCount <span style="color: #CC0099;">&gt;</span> <span style="color: #008080;">0</span> <span style="color: #009900;">THEN</span>
		<span style="color: #990099; font-weight: bold;">SET</span> MyPageTitle <span style="color: #CC0099;">=</span> <span style="color: #000099;">CONCAT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;The following Page<span style="color: #008080; font-weight: bold;">_</span>Title is already exists in database: &quot;</span><span style="color: #000033;">,</span> PageTitle<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
		<span style="color: #990099; font-weight: bold;">SELECT</span> MyPageTitle<span style="color: #000033;">;</span>
		LEAVE GoodBye<span style="color: #000033;">;</span>
  <span style="color: #009900;">END</span> <span style="color: #009900;">IF</span><span style="color: #000033;">;</span></pre></div></div>

<p>That code will tell us, if the record already exists, then display the custom message: &#8220;The following Page_Title is already exists in database: {ThePageTitle}&#8221;, and then exit from that SP by jumping to GoodBye label before the BEGIN statement above.</p>
<p>The rest of that code is for adding the new breadcrumb. Important to know, that I added the special handling for adding the first record if the table is still empty, and also for adding the second record and so forth. Please look at the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SET</span> RecCount <span style="color: #CC0099;">=</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #000099;">COUNT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #CC0099;">*</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
	<span style="color: #009900;">IF</span> RecCount <span style="color: #CC0099;">=</span> <span style="color: #008080;">0</span> <span style="color: #009900;">THEN</span>
		<span style="color: #808080; font-style: italic;">-- this is for handling the first record</span>
		<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #FF00FF;">&#40;</span>Page_Title<span style="color: #000033;">,</span> Page_URL<span style="color: #000033;">,</span> Lft<span style="color: #000033;">,</span> Rgt<span style="color: #FF00FF;">&#41;</span>
					<span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span>PageTitle<span style="color: #000033;">,</span> PageURL<span style="color: #000033;">,</span> <span style="color: #008080;">1</span><span style="color: #000033;">,</span> <span style="color: #008080;">2</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
	<span style="color: #009900;">ELSE</span>
		<span style="color: #808080; font-style: italic;">-- whereas the following is for the second record, and so forth!</span>
		<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #FF00FF;">&#40;</span>Page_Title<span style="color: #000033;">,</span> Page_URL<span style="color: #000033;">,</span> Lft<span style="color: #000033;">,</span> Rgt<span style="color: #FF00FF;">&#41;</span>
					<span style="color: #990099; font-weight: bold;">VALUES</span> <span style="color: #FF00FF;">&#40;</span>PageTitle<span style="color: #000033;">,</span> PageURL<span style="color: #000033;">,</span> ParentLevel<span style="color: #000033;">,</span> <span style="color: #FF00FF;">&#40;</span>ParentLevel <span style="color: #CC0099;">+</span> <span style="color: #008080;">1</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
	<span style="color: #009900;">END</span> <span style="color: #009900;">IF</span><span style="color: #000033;">;</span></pre></div></div>

<p>So, if you want to add your new breadcrumb record, simply execute this <strong>addnewbreadcrumb</strong> SP.
</li>
<li>
<h2>Removing or Deleting Breadcrumb</h2>
<p>Now let&#8217;s create another SP for deleting the certain breadcrumb based on the given <strong>PageTitle</strong> parameter. This SP only needs one parameter (PageTitle):</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">PROCEDURE</span> <span style="color: #008000;">`deletebreadcrumbbasedonpagetitle`</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">IN</span> <span style="color: #008000;">`PageTitle`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #990099; font-weight: bold;">BEGIN</span>
<span style="color: #808080; font-style: italic;">-- Need one parameter (PageTitle), look at the line: WHERE  Page_Title = PageTitle;</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> DeletedPageTitle <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> DeletedLft <span style="color: #999900; font-weight: bold;">INTEGER</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> DeletedRgt <span style="color: #999900; font-weight: bold;">INTEGER</span><span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span><span style="color: #000033;">,</span> <span style="color: #008000;">`Lft`</span><span style="color: #000033;">,</span> <span style="color: #008000;">`Rgt`</span>
<span style="color: #990099; font-weight: bold;">INTO</span>   DeletedPageTitle<span style="color: #000033;">,</span> DeletedLft<span style="color: #000033;">,</span> DeletedRgt
<span style="color: #990099; font-weight: bold;">FROM</span>   <span style="color: #008000;">`breadcrumblinks`</span>
<span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span> <span style="color: #CC0099;">=</span> PageTitle<span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">DELETE</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span>
<span style="color: #990099; font-weight: bold;">WHERE</span> Lft <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> DeletedLft <span style="color: #CC0099; font-weight: bold;">AND</span> DeletedRgt<span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">UPDATE</span> <span style="color: #008000;">`breadcrumblinks`</span>
   <span style="color: #990099; font-weight: bold;">SET</span> Lft <span style="color: #CC0099;">=</span> <span style="color: #009900;">CASE</span> <span style="color: #009900;">WHEN</span> Lft <span style="color: #CC0099;">&gt;</span> DeletedLft <span style="color: #009900;">THEN</span>
             Lft <span style="color: #CC0099;">-</span> <span style="color: #FF00FF;">&#40;</span>DeletedRgt <span style="color: #CC0099;">-</span> DeletedLft <span style="color: #CC0099;">+</span> <span style="color: #008080;">1</span><span style="color: #FF00FF;">&#41;</span>
          <span style="color: #009900;">ELSE</span>
             Lft
          <span style="color: #009900;">END</span><span style="color: #000033;">,</span>
       Rgt <span style="color: #CC0099;">=</span> <span style="color: #009900;">CASE</span> <span style="color: #009900;">WHEN</span> Rgt <span style="color: #CC0099;">&gt;</span> DeletedLft <span style="color: #009900;">THEN</span>
             Rgt <span style="color: #CC0099;">-</span> <span style="color: #FF00FF;">&#40;</span>DeletedRgt <span style="color: #CC0099;">-</span> DeletedLft <span style="color: #CC0099;">+</span> <span style="color: #008080;">1</span><span style="color: #FF00FF;">&#41;</span>
          <span style="color: #009900;">ELSE</span>
             Rgt
          <span style="color: #009900;">END</span>
   <span style="color: #990099; font-weight: bold;">WHERE</span> Lft <span style="color: #CC0099;">&gt;</span> DeletedLft
      <span style="color: #CC0099; font-weight: bold;">OR</span> Rgt <span style="color: #CC0099;">&gt;</span> DeletedLft<span style="color: #000033;">;</span>
<span style="color: #009900;">END</span></pre></div></div>

<p>If you want to remove or delete the certain breadcrumb record, simply execute this <strong>deletebreadcrumbbasedonpagetitle</strong> SP.
</li>
<li>
<h2>Moving Breadcrumb to Another Parent</h2>
<p>So far we have already had the 2 SPs for inserting and deleting breadcrumb records. How about moving breadcrumb? Good question! Now the most important thing that we have to handle is how we can move the certain breadcrumb from the current position to the new parent. This is very important, especially if you want to move the certain breadcrumb which have so many childs beneath it. So we will create the third SP as following:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">PROCEDURE</span> <span style="color: #008000;">`movebreadcrumb`</span><span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">IN</span> CurrentRoot <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> <span style="color: #990099; font-weight: bold;">IN</span> NewParent <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #990099; font-weight: bold;">BEGIN</span>
<span style="color: #808080; font-style: italic;">-- Need two parameters: (1) CurrentRoot, and (2) NewParent.</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> Origin_Lft <span style="color: #999900; font-weight: bold;">INTEGER</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> Origin_Rgt <span style="color: #999900; font-weight: bold;">INTEGER</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">DECLARE</span> NewParent_Rgt <span style="color: #999900; font-weight: bold;">INTEGER</span><span style="color: #000033;">;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #008000;">`Lft`</span><span style="color: #000033;">,</span> <span style="color: #008000;">`Rgt`</span>
	<span style="color: #990099; font-weight: bold;">INTO</span> Origin_Lft<span style="color: #000033;">,</span> Origin_Rgt
	<span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span>
	<span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span> <span style="color: #CC0099;">=</span> CurrentRoot<span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">SET</span> NewParent_Rgt <span style="color: #CC0099;">=</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #008000;">`Rgt`</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span>
	<span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #008000;">`Page<span style="color: #008080; font-weight: bold;">_</span>Title`</span> <span style="color: #CC0099;">=</span> NewParent<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">UPDATE</span> <span style="color: #008000;">`breadcrumblinks`</span> 
	<span style="color: #990099; font-weight: bold;">SET</span> <span style="color: #008000;">`Lft`</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">`Lft`</span> <span style="color: #CC0099;">+</span> 
	<span style="color: #009900;">CASE</span>
		<span style="color: #009900;">WHEN</span> NewParent_Rgt <span style="color: #CC0099;">&lt;</span> Origin_Lft
			<span style="color: #009900;">THEN</span> <span style="color: #009900;">CASE</span>
				<span style="color: #009900;">WHEN</span> Lft <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> Origin_Lft <span style="color: #CC0099; font-weight: bold;">AND</span> Origin_Rgt
					<span style="color: #009900;">THEN</span> NewParent_Rgt <span style="color: #CC0099;">-</span> Origin_Lft
				<span style="color: #009900;">WHEN</span> Lft <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> NewParent_Rgt	<span style="color: #CC0099; font-weight: bold;">AND</span> Origin_Lft <span style="color: #CC0099;">-</span> <span style="color: #008080;">1</span>
					<span style="color: #009900;">THEN</span> Origin_Rgt <span style="color: #CC0099;">-</span> Origin_Lft <span style="color: #CC0099;">+</span> <span style="color: #008080;">1</span>
				<span style="color: #009900;">ELSE</span> <span style="color: #008080;">0</span> <span style="color: #009900;">END</span>
		<span style="color: #009900;">WHEN</span> NewParent_Rgt <span style="color: #CC0099;">&gt;</span> Origin_Rgt
			<span style="color: #009900;">THEN</span> <span style="color: #009900;">CASE</span>
				<span style="color: #009900;">WHEN</span> Lft <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> Origin_Lft	<span style="color: #CC0099; font-weight: bold;">AND</span> Origin_Rgt
					<span style="color: #009900;">THEN</span> NewParent_Rgt <span style="color: #CC0099;">-</span> Origin_Rgt <span style="color: #CC0099;">-</span> <span style="color: #008080;">1</span>
				<span style="color: #009900;">WHEN</span> Lft <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> Origin_Rgt <span style="color: #CC0099;">+</span> <span style="color: #008080;">1</span> <span style="color: #CC0099; font-weight: bold;">AND</span> NewParent_Rgt <span style="color: #CC0099;">-</span> <span style="color: #008080;">1</span>
					<span style="color: #009900;">THEN</span> Origin_Lft <span style="color: #CC0099;">-</span> Origin_Rgt <span style="color: #CC0099;">-</span> <span style="color: #008080;">1</span>
				<span style="color: #009900;">ELSE</span> <span style="color: #008080;">0</span> <span style="color: #009900;">END</span>
			<span style="color: #009900;">ELSE</span> <span style="color: #008080;">0</span> <span style="color: #009900;">END</span><span style="color: #000033;">,</span>
	Rgt <span style="color: #CC0099;">=</span> Rgt <span style="color: #CC0099;">+</span> 
	<span style="color: #009900;">CASE</span>
		<span style="color: #009900;">WHEN</span> NewParent_Rgt <span style="color: #CC0099;">&lt;</span> Origin_Lft
			<span style="color: #009900;">THEN</span> <span style="color: #009900;">CASE</span>
		<span style="color: #009900;">WHEN</span> Rgt <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> Origin_Lft <span style="color: #CC0099; font-weight: bold;">AND</span> Origin_Rgt
			<span style="color: #009900;">THEN</span> NewParent_Rgt <span style="color: #CC0099;">-</span> Origin_Lft
		<span style="color: #009900;">WHEN</span> Rgt <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> NewParent_Rgt <span style="color: #CC0099; font-weight: bold;">AND</span> Origin_Lft <span style="color: #CC0099;">-</span> <span style="color: #008080;">1</span>
			<span style="color: #009900;">THEN</span> Origin_Rgt <span style="color: #CC0099;">-</span> Origin_Lft <span style="color: #CC0099;">+</span> <span style="color: #008080;">1</span>
		<span style="color: #009900;">ELSE</span> <span style="color: #008080;">0</span> <span style="color: #009900;">END</span>
		<span style="color: #009900;">WHEN</span> NewParent_Rgt <span style="color: #CC0099;">&gt;</span> Origin_Rgt
			<span style="color: #009900;">THEN</span> <span style="color: #009900;">CASE</span>
				<span style="color: #009900;">WHEN</span> Rgt <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> Origin_Lft <span style="color: #CC0099; font-weight: bold;">AND</span> Origin_Rgt
					<span style="color: #009900;">THEN</span> NewParent_Rgt <span style="color: #CC0099;">-</span> Origin_Rgt <span style="color: #CC0099;">-</span> <span style="color: #008080;">1</span>
				<span style="color: #009900;">WHEN</span> Rgt <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> Origin_Rgt <span style="color: #CC0099;">+</span> <span style="color: #008080;">1</span>	<span style="color: #CC0099; font-weight: bold;">AND</span> NewParent_Rgt <span style="color: #CC0099;">-</span> <span style="color: #008080;">1</span>
					<span style="color: #009900;">THEN</span> Origin_Lft <span style="color: #CC0099;">-</span> Origin_Rgt <span style="color: #CC0099;">-</span> <span style="color: #008080;">1</span>
				<span style="color: #009900;">ELSE</span> <span style="color: #008080;">0</span> <span style="color: #009900;">END</span>
			<span style="color: #009900;">ELSE</span> <span style="color: #008080;">0</span> <span style="color: #009900;">END</span><span style="color: #000033;">;</span>
<span style="color: #009900;">END</span></pre></div></div>

<p>You will see that this SP needs two parameter as you can see from this following line:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">PROCEDURE</span> <span style="color: #008000;">`movebreadcrumb`</span><span style="color: #FF00FF;">&#40;</span><span style="color: #990099; font-weight: bold;">IN</span> CurrentRoot <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> <span style="color: #990099; font-weight: bold;">IN</span> NewParent <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">100</span><span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>They are:<br />
- <strong>CurrentRoot</strong>: This is the name of the current page title that you want to move.<br />
- <strong>NewParent</strong>: This is the name of the page title where the CurrentRoot will be moved to. In other words, this is the new parent page title where the CurrentRoot will be located after the moving process is successfully done.</p>
<p>If you want to move the certain breadcrumb record, simply execute this <strong>movebreadcrumb</strong> SP.
</li>
<li>
<h2>Retrieving Breadcrumb</h2>
<p>As I mentioned above, you only need one query to get the full path of the certain given page.<br />
Here is one of the example of the code how you can retrieve the certain breadcrumb of the (e.g) &#8216;Statistik per Jam&#8217; page:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SELECT</span> C.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #990099; font-weight: bold;">AS</span> B<span style="color: #000033;">,</span> <span style="color: #008000;">`breadcrumblinks`</span> <span style="color: #990099; font-weight: bold;">AS</span> C
<span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #FF00FF;">&#40;</span>B.Lft <span style="color: #CC0099; font-weight: bold;">BETWEEN</span> C.Lft <span style="color: #CC0099; font-weight: bold;">AND</span> C.Rgt<span style="color: #FF00FF;">&#41;</span>
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #FF00FF;">&#40;</span>B.Page_Title <span style="color: #CC0099;">=</span> <span style="color: #008000;">'Statistik per Jam'</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #990099; font-weight: bold;">ORDER BY</span> C.Lft<span style="color: #000033;">;</span></pre></div></div>

</li>
</ol>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2011%2F12%2F05%2Fhow-to-create-breadcrumb-using-the-nested-set-data-model-in-mysql%2F&amp;title=How%20to%20Create%20Breadcrumb%20Using%20the%20Nested%20Set%20Data%20Model%20in%20MySQL" id="wpa2a_6"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2011/12/05/how-to-create-breadcrumb-using-the-nested-set-data-model-in-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mandatory Attachments for Client Side of osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2011/10/08/mandatory-attachments-for-client-side-of-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2011/10/08/mandatory-attachments-for-client-side-of-osticket-1-6-st/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 10:39:07 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[browse for file]]></category>
		<category><![CDATA[client-side]]></category>
		<category><![CDATA[lampiran]]></category>
		<category><![CDATA[mandatory]]></category>
		<category><![CDATA[multiple]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1465</guid>
		<description><![CDATA[This following modification will answer the request that being asked via this thread in osTicket Discussion Forum. Since I created this modification based on my Multiple Attachments for Client Side of osTicket 1.6 RC5 modification (this mod also works fine in 1.6 ST version), then you have to implement that multiple attachments mod first before [...]]]></description>
			<content:encoded><![CDATA[<p>This following modification will answer the request that being asked via <a href="http://www.osticket.com/forums/showthread.php?t=6579" title="MOD Request - Mandatory Attachments" target="_blank">this thread</a> in osTicket Discussion Forum. Since I created this modification based on my <a href="http://www.openscriptsolution.com/2009/10/25/multiple-attachments-for-client-side-of-osticket-v1-6-rc5/" title="Multiple Attachments for Client Side of osTicket 1.6 RC5" target="_blank">Multiple Attachments for Client Side of osTicket 1.6 RC5</a> modification (this mod also works fine in 1.6 ST version), then you have to implement that multiple attachments mod first before implementing the following modification below. Well, here is the important things that you need to know regarding the mandatory attachments modification below. I added a new setting from the Admin Panel -> Settings -> Attachments in order to set whether you will allow the mandatory attachments when your client submitting a ticket or not. For this purpose, I alter the ost_config table by adding a new field. After implementing the modification code below, then you have to go first to your <strong>Admin Panel</strong> -> <strong>Settings</strong> -> <strong>Attachments</strong>, and make sure you have already given a tick mark at the &#8220;Mandatory Attachments&#8221; -> &#8220;Allow Mandatory Attachments&#8221; in that page. You can enable or disable this mandatory attachments feature anytime you want.</p>
<ol>
<li>
First of all, alter your <strong>ost_config</strong> table by adding a new field called <strong>allow_mandatory_attachments</strong> by using the following script into your osTicket database (please adjust the table prefix if you are using the different one with mine using ost_):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">ALTER TABLE `ost_config` ADD COLUMN `allow_mandatory_attachments` TINYINT(1)  NOT NULL DEFAULT '0' AFTER `allow_attachments`;</pre></div></div>

</li>
<li>
Open your <strong>/include/client/open.inc.php</strong> file, and find this code (you will never find this code if you have not implemented the Multiple Attachments for Client Side of osTicket 1.6 RC5 mod above):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        &lt;td&gt;
            &lt;!-- &lt;input type=&quot;file&quot; name=&quot;attachment&quot;&gt;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt; --&gt;
            &lt;input id=&quot;my_file_element&quot; type=&quot;file&quot; name=&quot;file_1&quot; &gt;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file_1'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
        &lt;/td&gt;</pre></div></div>

<p>then replace it with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        &lt;td&gt;
            &lt;!-- &lt;input type=&quot;file&quot; name=&quot;attachment&quot;&gt;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt; --&gt;
            &lt;input id=&quot;my_file_element&quot; type=&quot;file&quot; name=&quot;file_1&quot; value=&quot;document.getElementById( 'my_file_element' )&quot;&gt;&lt;font class=&quot;error&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011  </span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">allowMandatoryAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&amp;nbsp;*'</span><span style="color: #339933;">;</span> 
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> 
			  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> 
			<span style="color: #009900;">&#125;</span> 
			<span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011 ?&gt;&amp;nbsp;&lt;?=$errors['file_1']</span>
			<span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/font&gt;
        &lt;/td&gt;</pre></div></div>

</li>
<li>
Open your <strong>/include/class.ticket.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span>     <span style="color: #0000ff;">'required'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'error'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Message required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>after that line, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">allowAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">allowMandatoryAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$totalsize</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
          <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #000088;">$totalsize</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$totalsize</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'size'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
          <span style="color: #009900;">&#125;</span>
          <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$totalsize</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
             <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file_1'</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'string'</span><span style="color: #339933;">,</span>     <span style="color: #0000ff;">'required'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'error'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Attachment file(s) required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span></pre></div></div>

<p>So here is the idea for this mod. First of all, we checked whether the system is allowing the attachments and the mandatory attachments. Secondly, it will check the file size of the attachments in order to make sure the current ticket has the attachments file attached to it. If the conditions in first step are met but the file size is equal with zero, then system reject or cancel the submission and inform the client of a missing attachment.
</li>
<li>
Open your <strong>/include/class.config.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> allowAttachments<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span>
    <span style="color: #000000; font-weight: bold;">function</span> allowMandatoryAttachments<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_mandatory_attachments'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span></pre></div></div>

</li>
<li>
Open your <strong>/include/staff/attachment.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">          &lt;tr&gt;
            &lt;th width=&quot;165&quot;&gt;Allow Attachments:&lt;/th&gt;
            &lt;td&gt;
              &lt;input type=&quot;checkbox&quot; name=&quot;allow_attachments&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span> ?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;&lt;b&gt;Allow Attachments&lt;/b&gt;
                &amp;nbsp; (&lt;i&gt;Global Setting&lt;/i&gt;)
                &amp;nbsp;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
            &lt;/td&gt;
          &lt;/tr&gt;</pre></div></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">          <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011 ?&gt;</span>
          <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>th width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;165&quot;</span><span style="color: #339933;">&gt;</span>Mandatory Attachments<span style="color: #339933;">:&lt;/</span>th<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>
              <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;allow_mandatory attachments&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_mandatory_attachments'</span><span style="color: #009900;">&#93;</span> ?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;&lt;b&gt;Allow Mandatory Attachments&lt;/b&gt;  &amp;nbsp;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_mandatory_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
          <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011 ?&gt;</span></pre></div></div>

</li>
<li>
Open your <strong>/scp/admin.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">               <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>CONFIG_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET allow_attachments='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                    <span style="color: #0000ff;">',upload_dir='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'upload_dir'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></div></div>

<p>then replace it with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">               <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>CONFIG_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET allow_attachments='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                     <span style="color: #0000ff;">',allow_mandatory_attachments='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_mandatory_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span>
                    <span style="color: #0000ff;">',upload_dir='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'upload_dir'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></div></div>

</li>
</ol>
<p>Once again, I remind you, please do not forget to set Mandatory Attachments after implementing the modification code above. Go to your <strong>Admin Panel</strong> -> <strong>Settings</strong> -> <strong>Attachments</strong>, and give a tick mark at the &#8220;Mandatory Attachments&#8221; -> &#8220;Allow Mandatory Attachments&#8221;, and save the settings, afterwards you will be able to allow the mandatory attachments for your client on submitting a ticket via your osTicket system.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2011%2F10%2F08%2Fmandatory-attachments-for-client-side-of-osticket-1-6-st%2F&amp;title=Mandatory%20Attachments%20for%20Client%20Side%20of%20osTicket%201.6%20ST" id="wpa2a_8"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2011/10/08/mandatory-attachments-for-client-side-of-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Define Data Type for the Certain Column Using WP-Table Reloaded Plugin of WordPress</title>
		<link>http://www.openscriptsolution.com/2011/09/22/how-to-define-data-type-for-the-certain-column-using-wp-table-reloaded-plugin-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2011/09/22/how-to-define-data-type-for-the-certain-column-using-wp-table-reloaded-plugin-of-wordpress/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 12:14:12 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[data type]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WP Table Reloaded]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1455</guid>
		<description><![CDATA[The following information will give you the idea how to define the certain data type for the certain columns in the table that you created with WP-Table Reloaded plugin. Sometimes one of your columns in that table might be contains the Numeric data type. For example, you have a column named &#8220;Quantity&#8221; so the data [...]]]></description>
			<content:encoded><![CDATA[<p>The following information will give you the idea how to define the certain data type for the certain columns in the table that you created with <a href="http://wordpress.org/extend/plugins/wp-table-reloaded/" title="WP Table Reloaded" target="_blank">WP-Table Reloaded</a> plugin. Sometimes one of your columns in that table might be contains the Numeric data type. For example, you have a column named &#8220;Quantity&#8221; so the data in that column should be the Numeric data type. In order to sort that column properly, then you have to decide and define that &#8220;Quantity&#8221; column as the Numeric data type. So here is the trick how you can set the data type for the certain column using WP-Table Reloaded plugin in your WordPress website.</p>
<ol>
<li>
Go to your wp-admin (Dashboard), click on <strong>Tools</strong> -> <strong>WP-Table Reloaded</strong>, edit your existing table, then insert this following code into your <strong>Custom Commands</strong> text field in the <strong>DataTables JavaScript Features</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&quot;aoColumns&quot;: [ { &quot;sSortDataType&quot;: &quot;dom-text&quot; }, { &quot;sSortDataType&quot;: &quot;dom-text&quot; }, { &quot;sSortDataType&quot;: &quot;dom-text&quot; }, { &quot;sSortDataType&quot;: &quot;dom-text&quot; }, { &quot;sSortDataType&quot;: &quot;numeric&quot;, &quot;sType&quot;: &quot;numeric&quot; }]</pre></div></div>

<p>From that code above, in order to define the columns, we use <strong>aoColumns</strong> as the keyword. We can see that from the first until the fourth column has <strong>sSortDataType</strong> property and the value is <strong>dom-text</strong>. In the fifth column, both <strong>sSortDataType</strong> and <strong>sType</strong> have the value of <strong>numeric</strong>.
</li>
<li>
Save the changes and reload your table in the front-end of your website.
</li>
</ol>
<p>The important thing that you need to know is when you define a column as the Numeric data type, then you cannot insert another the different data type. In addition, you cannot format the data, for example, by adding the comma or dot character as separator directly to the data.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2011%2F09%2F22%2Fhow-to-define-data-type-for-the-certain-column-using-wp-table-reloaded-plugin-of-wordpress%2F&amp;title=How%20to%20Define%20Data%20Type%20for%20the%20Certain%20Column%20Using%20WP-Table%20Reloaded%20Plugin%20of%20WordPress" id="wpa2a_10"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2011/09/22/how-to-define-data-type-for-the-certain-column-using-wp-table-reloaded-plugin-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Adjust Text Align for the Certain Row and Column in the Table Using WP-Table Reloaded Plugin of WordPress</title>
		<link>http://www.openscriptsolution.com/2011/09/21/how-to-adjust-text-align-for-the-certain-rown-and-column-in-the-table-using-wp-table-reloaded-plugin-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2011/09/21/how-to-adjust-text-align-for-the-certain-rown-and-column-in-the-table-using-wp-table-reloaded-plugin-of-wordpress/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 04:52:01 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[Custom CSS]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[stylesheet]]></category>
		<category><![CDATA[tabel]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP Table Reloaded]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1449</guid>
		<description><![CDATA[One of the advantages of WP-Table Reloaded plugin is the ability to define your custom stylesheet from its Plugins Options section. It means, you don&#8217;t have to touch or edit the core file of this plugin. Since this will overide the default style that has been defined in the .css file of the plugin, then [...]]]></description>
			<content:encoded><![CDATA[<p>One of the advantages of <a href="http://wordpress.org/extend/plugins/wp-table-reloaded/" title="WP Table Reloaded" target="_blank">WP-Table Reloaded</a> plugin is the ability to define your custom stylesheet from its <strong>Plugins Options</strong> section. It means, you don&#8217;t have to touch or edit the core file of this plugin. Since this will overide the default style that has been defined in the .css file of the plugin, then you don&#8217;t have to worry losing your customization in the core file after you update this plugin in the future. This following trick will give you the ideas how you can define your own stylesheet by yourself easily and quickly without having to edit the core file of the plugin. For example, in this case, I want to make all of the text align in the table heading (the first row in the entire table) to become align-center, and then make the text align in the whole first and fourth columns to become align-right, and finally, make the text align for the whole data in the third column to become align-center. </p>
<p>Here is the steps you have to do:</p>
<ol>
<li>
Go to your wp-admin (Dashboard) of your website, and click on the <strong>Tools</strong> -> <strong>WP-Table Reloaded</strong>, and then click on the <strong>Plugin Options</strong>.
</li>
<li>
Make sure you have already checked the &#8220;Yes, include and load the following custom CSS commands. This should be used to change the table layout and styling.&#8221; item, next to the &#8220;Custom CSS:&#8221; directive.
</li>
<li>
In the <strong>Custom CSS:</strong> directive, enter this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.wp-table-reloaded-id-1</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-1</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-2</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-3</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-4</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-5</span> <span style="color: #00AA00;">&#123;</span> 
      <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.wp-table-reloaded-id-1</span> <span style="color: #6666ff;">.column-1</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.column-4</span> <span style="color: #00AA00;">&#123;</span> 
      <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.wp-table-reloaded-id-1</span> <span style="color: #6666ff;">.column-3</span> <span style="color: #00AA00;">&#123;</span> 
      <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>From that code above, assuming there is only one table (with table id = 1) that I have created, so you will see that <strong>.wp-table-reloaded-id-1</strong> means that this style will be applied to the table which has the table id = 1. If you want to apply it also to another table (for example the table which table id = 2), then simply using <strong>.wp-table-reloaded-id-2</strong>, and so on.</p>
<p>Another important thing that you need to know is that if you want to change the table style only for the certain row and column, then you have to write down the <strong>.row</strong> part must precede the <strong>.column</strong>, as being shown in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.wp-table-reloaded-id-1</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-1</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-2</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-3</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-4</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.row-1</span> <span style="color: #6666ff;">.column-5</span> <span style="color: #00AA00;">&#123;</span> 
      <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>But if you want to change the style for the whole column (regardless which row it is), then you don&#8217;t need to include the .row, as being shown in the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.wp-table-reloaded-id-1</span> <span style="color: #6666ff;">.column-1</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.column-4</span> <span style="color: #00AA00;">&#123;</span> 
      <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.wp-table-reloaded-id-1</span> <span style="color: #6666ff;">.column-3</span> <span style="color: #00AA00;">&#123;</span> 
      <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</li>
<li>
Save the changes, and make sure your table has a new style.
</li>
</ol>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2011%2F09%2F21%2Fhow-to-adjust-text-align-for-the-certain-rown-and-column-in-the-table-using-wp-table-reloaded-plugin-of-wordpress%2F&amp;title=How%20to%20Adjust%20Text%20Align%20for%20the%20Certain%20Row%20and%20Column%20in%20the%20Table%20Using%20WP-Table%20Reloaded%20Plugin%20of%20WordPress" id="wpa2a_12"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2011/09/21/how-to-adjust-text-align-for-the-certain-rown-and-column-in-the-table-using-wp-table-reloaded-plugin-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Change The Default Selected Record Count in WP Table Reloaded Plugin of WordPress</title>
		<link>http://www.openscriptsolution.com/2011/09/20/how-to-change-the-default-selected-record-count-in-wp-table-reloaded-plugin-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2011/09/20/how-to-change-the-default-selected-record-count-in-wp-table-reloaded-plugin-of-wordpress/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 06:57:17 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jumlah baris terpilih]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[selected record count]]></category>
		<category><![CDATA[selected row]]></category>
		<category><![CDATA[WP Table Reloaded]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1443</guid>
		<description><![CDATA[For those of you who are using the WP Table Reloaded plugin in your WordPress website, then you will find that until the 1.9.2 version, there is no setting that provided by the author of this plugin to change the default selected record count or rows in the table. It means that when you create [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who are using the <a href="http://wordpress.org/extend/plugins/wp-table-reloaded/" title="WP Table Reloaded" target="_blank">WP Table Reloaded</a> plugin in your WordPress website, then you will find that until the 1.9.2 version, there is no setting that provided by the author of this plugin to change the default selected record count or rows in the table. It means that when you create a table which has the record count or rows in the table is more than 10, then you will see that by default, your table will display 10 rows for the very first time. Even this table has provided the other options value that you can choose to change to another value, sometimes you do not want to display 10 rows by default. The question is, how can I change this selected record count default value whereas there is no option setting regarding this, for example I want to change it with 50 so each time the table is reloaded, it will display the first 50 records? The next question: Can I also change or add the other values in the <strong>Show entry</strong> selector? Here is the modification I created to answer those both questions.</p>
<ol>
<li>
Open your <strong>/wp-content/plugins/wp-table-reloaded/js/jquery.datatables.min.js</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">aLengthMenu=[10,25,50,100]</pre></div></div>

<p>then replace it with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">aLengthMenu=[5,10,25,50,100,200,500]</pre></div></div>

<p>In this case, we will add the other options besides the existing values &#8220;10,25,50,100&#8243; (4 options value) to become &#8220;5,10,25,50,100,200,500&#8243; (7 options value).
</li>
<li>
Still in that .js file, find again this code:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">this._iDisplayLength=10;this._iDisplayStart=0;this._iDisplayEnd=10;</pre></div></div>

<p>then replace it with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">this._iDisplayLength=50;this._iDisplayStart=0;this._iDisplayEnd=50;</pre></div></div>

<p>It means that we will change the default selected record count in the table from 10 to 50. For example, your table has 175 records or rows in it, then each time your table will be displayed, there are at least maximum 50 instead of 10 records in that table for the very first time.
</li>
</ol>
<p>Keep in mind that since this modification involves the javascript file that belongs to this plugin, then you have to re-apply the modification each time after you update this plugin to the latest version. Hope it helps.</p>
<p><strong>Edited</strong> (a few minutes after I submit this post): After involving discussion with Tobias in <a href="http://wordpress.org/support/topic/plugin-wp-table-reloaded-wp-tables-reloaded-add-show-all-option?replies=5" title="Add Show All Option" target="_blank">this thread</a>, I found the best approach in order to not edit the core file of this plugin.</p>
<p>Here is the trick how you can change the default selected record count or rows value and how you can change (add/edit/remove) the options value in the <strong>Show entries</strong> selector:</p>
<ol>
<li>
Go to your wp-admin (Dashboard), click on &#8220;Tools&#8221; -> &#8220;WP-Table Reloaded&#8221;, edit your existing table, then insert this following code (according to the original example in the modification above) into your &#8220;Custom Commands&#8221; text field in the &#8220;DataTables JavaScript Features&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">&quot;aLengthMenu&quot;: [[5, 10, 25, 50, 100, 200, 500, -1], [5, 10, 25, 50, 100, 200, 500, &quot;All&quot;]], &quot;iDisplayLength&quot;: 100</pre></div></div>

<p>There are two parts from the command code that we need to know.<br />
- <strong>aLengthMenu</strong>, holds the options value in &#8220;Show entries&#8221; selector that you can set it up by yourself. &#8220;-1&#8243; in the left side is equal with the &#8220;All&#8221; string that will be displayed in the front-end.<br />
- <strong>iDisplayLength</strong>, holds the default selected record count or rows when your table is reloaded for the very first time. I set it up with 100 instead of 50, in order to make sure that this command code will overide the change I made in the javascript file above.</p>
<p>The main benefit of this command code that I will not worry losing my modification after update it to the latest version.
</li>
<li>
Save the changes and see the results.
</li>
</ol>
<p>Again, thanks to Tobias for pointing it out to us. <img src='http://www.openscriptsolution.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2011%2F09%2F20%2Fhow-to-change-the-default-selected-record-count-in-wp-table-reloaded-plugin-of-wordpress%2F&amp;title=How%20to%20Change%20The%20Default%20Selected%20Record%20Count%20in%20WP%20Table%20Reloaded%20Plugin%20of%20WordPress" id="wpa2a_14"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2011/09/20/how-to-change-the-default-selected-record-count-in-wp-table-reloaded-plugin-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Translate &#8220;Continue Reading&#8221; Text in Genesis Slider 0.9.4 Plugin of WordPress</title>
		<link>http://www.openscriptsolution.com/2011/09/15/how-to-translate-continue-reading-text-in-genesis-slider-0-9-4-plugin-of-wordpress/</link>
		<comments>http://www.openscriptsolution.com/2011/09/15/how-to-translate-continue-reading-text-in-genesis-slider-0-9-4-plugin-of-wordpress/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 12:08:04 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Genesis]]></category>
		<category><![CDATA[Genesis Slider]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[Read More]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[WordPress Theme]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1435</guid>
		<description><![CDATA[Today I changed some of my website that use Genesis Theme Framework using Genesis Slider plugin. This plugin allows you to create a simple slider that displays the featured image, along with the title and excerpt from each post or page. It seems that all went well, until I discovered the condition that the &#8220;Continue [...]]]></description>
			<content:encoded><![CDATA[<p>Today I changed some of my website that use <a href="http://www.studiopress.com" title="Genesis Theme Framework" target="_blank">Genesis Theme Framework</a> using <a href="http://www.studiopress.com/plugins/genesis-slider" title="Genesis Slider plugin" target="_blank">Genesis Slider</a> plugin. This plugin allows you to create a simple slider that displays the featured image, along with the title and excerpt from each post or page. It seems that all went well, until I discovered the condition that the &#8220;Continue Reading&#8221; text is not translated properly in the slider content. So I modified the plugin in order to support multi-language for the &#8220;Continue Reading&#8221;. I hope the author will include this fix in the next release. Some of them are the websites which have the content that supports for multi-language. One of my multi language websites that I have successfully modified is that you can see it from <a href="http://www.masinosinaga.com" title="Masino Sinaga - Never stop innovating ..." target="_blank">here</a>, and you could see the demo how it looks in another language <a href="http://www.masinosinaga.com/id/" title="Masino Sinaga - Tak pernah berhenti berinovasi" target="_blank">here</a>. </p>
<p>Only a small change, actually. Open your <strong>/wp-content/plugins/genesis-slider/plugin.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$read_more</span> <span style="color: #339933;">=</span> genesis_get_slider_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'slideshow_more_text'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>then replace it with this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$read_more</span> <span style="color: #339933;">=</span> __<span style="color: #009900;">&#40;</span>genesis_get_slider_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'slideshow_more_text'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'genesis-slider'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// modified by Masino Sinaga, September 15, 2011</span></pre></div></div>

<p>Hope it helps. <img src='http://www.openscriptsolution.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2011%2F09%2F15%2Fhow-to-translate-continue-reading-text-in-genesis-slider-0-9-4-plugin-of-wordpress%2F&amp;title=How%20to%20Translate%20%E2%80%9CContinue%20Reading%E2%80%9D%20Text%20in%20Genesis%20Slider%200.9.4%20Plugin%20of%20WordPress" id="wpa2a_16"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2011/09/15/how-to-translate-continue-reading-text-in-genesis-slider-0-9-4-plugin-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to List All Attachment Files in the View Ticket Page of osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2011/09/12/how-to-list-all-attachment-files-in-the-view-ticket-page-of-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2011/09/12/how-to-list-all-attachment-files-in-the-view-ticket-page-of-osticket-1-6-st/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 16:34:57 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[v1.6 ST]]></category>
		<category><![CDATA[viewticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1429</guid>
		<description><![CDATA[Because the number of the attachment files in a ticket could be increasing anytime, which these attachment files can be derived from the client when creating and reply to a ticket, as well as uploaded by staff when replying to ticket, then consider the situation where your staff someday wants to see or to search [...]]]></description>
			<content:encoded><![CDATA[<p>Because the number of the attachment files in a ticket could be increasing anytime, which these attachment files can be derived from the client when creating and reply to a ticket, as well as uploaded by staff when replying to ticket, then consider the situation where your staff someday wants to see or to search the certain attachment files simply from a list that contains all those attachment files for the current ticket. The benefits of this feature for your staff is very pronounced, especially if they want to search and download the certain attachment files without having to seek it from or browse for them one by one from the messages that located in the Ticket Thread section. This following modifications will solve the problem in osTicket 1.6 ST. After implementing this modification, now your staff will be easier to find the certain attachment files from a list. You will see that there is a new tab appear named &#8220;Attachments&#8221; in the view ticket page. This tab will only appear if the current ticket has at least one attachment file.</p>
<ol>
<li>
Open your <strong>/include/staff/viewticket.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabber&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

<p>after that line, insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD List Attachment Files in View Ticket, by Masino Sinaga, September 12, 2011 ?&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;div id=&quot;attachments&quot; class=&quot;tabbertab&quot;&gt;
      &lt;h2&gt;Attachments&lt;/h2&gt;		
        &lt;table align=&quot;center&quot; class=&quot;message&quot; cellspacing=&quot;0&quot; cellpadding=&quot;1&quot; width=&quot;100%&quot; border=0&gt;
         &lt;tr class=&quot;header&quot;&gt;&lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;&lt;/tr&gt; 
		&lt;/table&gt;
    &lt;/div&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD List Attachment Files in View Ticket, by Masino Sinaga, September 12, 2011 ?&gt;</span></pre></div></div>

</li>
<li>
Open your <strong>/include/class.ticket.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> getAttachmentStr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$refid</span><span style="color: #339933;">,</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></pre></div></div>

<p>before that line, insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// Begin of MOD List Attachment Files in View Ticket, by Masino Sinaga, September 8, 2011</span>
    <span style="color: #000000; font-weight: bold;">function</span> getAttachments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$refid</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>        
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT attach_id,ref_id,file_size,file_name FROM '</span><span style="color: #339933;">.</span>TICKET_ATTACHMENT_TABLE<span style="color: #339933;">.</span>
             <span style="color: #0000ff;">' WHERE deleted=0 AND ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">' ORDER BY attach_id DESC'</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$res</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span> <span style="color: #339933;">&amp;&amp;</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span><span style="color: #000088;">$refid</span><span style="color: #339933;">,</span><span style="color: #000088;">$size</span><span style="color: #339933;">,</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span>db_fetch_row<span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$hash</span><span style="color: #339933;">=</span><span style="color: #990000;">MD5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #000088;">$refid</span><span style="color: #339933;">.</span><span style="color: #990000;">session_id</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$size</span><span style="color: #339933;">=</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">file_size</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$name</span><span style="color: #339933;">=</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">htmlchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$attachstr</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;a class='Icon file' href='attachment.php?id=<span style="color: #006699; font-weight: bold;">$id</span>&amp;ref=<span style="color: #006699; font-weight: bold;">$hash</span>' target='_blank'&gt;&lt;b&gt;<span style="color: #006699; font-weight: bold;">$name</span>&lt;/b&gt;&lt;/a&gt;&amp;nbsp;(&lt;i&gt;<span style="color: #006699; font-weight: bold;">$size</span>&lt;/i&gt;)&amp;nbsp;&amp;nbsp;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$attachstr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> checkAttachments<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT file_name FROM '</span><span style="color: #339933;">.</span>TICKET_ATTACHMENT_TABLE<span style="color: #339933;">.</span>
             <span style="color: #0000ff;">' WHERE deleted=0 AND ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$res</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span> <span style="color: #339933;">&amp;&amp;</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
           <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
           <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// End of MOD List Attachment Files in View Ticket, by Masino Sinaga, September 8, 2011</span></pre></div></div>

</li>
</ol>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2011%2F09%2F12%2Fhow-to-list-all-attachment-files-in-the-view-ticket-page-of-osticket-1-6-st%2F&amp;title=How%20to%20List%20All%20Attachment%20Files%20in%20the%20View%20Ticket%20Page%20of%20osTicket%201.6%20ST" id="wpa2a_18"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2011/09/12/how-to-list-all-attachment-files-in-the-view-ticket-page-of-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to Collapse Both the Internal Notes and the Ticket Thread as Default in osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2011/09/04/how-to-collapse-both-the-internal-notes-and-the-ticket-thread-as-default-in-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2011/09/04/how-to-collapse-both-the-internal-notes-and-the-ticket-thread-as-default-in-osticket-1-6-st/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 05:30:09 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[collapse]]></category>
		<category><![CDATA[expand]]></category>
		<category><![CDATA[Internal Notes]]></category>
		<category><![CDATA[Ticket Thread]]></category>
		<category><![CDATA[v1.6 ST]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1425</guid>
		<description><![CDATA[For those of you who want to collapse both the Internal Notes and the Ticket Thread sections as default in osTicket 1.6 ST, then this following modification is definitely right for you. Now each time your staff views a ticket, then the Internal Notes and the Ticket Thread sections will automatically be collapsed as default. [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who want to collapse both the Internal Notes and the Ticket Thread sections as default in osTicket 1.6 ST, then this following modification is definitely right for you. Now each time your staff views a ticket, then the Internal Notes and the Ticket Thread sections will automatically be collapsed as default. Staff has to click on its title in order to expand the content of it (toggle link). As this is a simple modification, there is only one file that you need to edit in order to implement this, it&#8217;s a <strong>viewticket.inc.php</strong> that located in the <strong>/include/staff/</strong> sub-directory. <span id="more-1425"></span></p>
<ol>
<li>
Open your <strong>/include/staff/viewticket.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div id='ticketnotes' style=&quot;display:<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$display</span><span style="color: #000000; font-weight: bold;">?&gt;</span>;text-align:center;&quot;&gt;</pre></div></div>

<p>then replace it with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">'ticketnotes'</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;display:none;text-align:center;&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

</li>
<li>
Still in the same file above, find again this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ticketthread&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

<p>then replace it with this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ticketthread&quot;</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;display:none&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

</li>
</ol>
<p>Hope it helps.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2011%2F09%2F04%2Fhow-to-collapse-both-the-internal-notes-and-the-ticket-thread-as-default-in-osticket-1-6-st%2F&amp;title=How%20to%20Collapse%20Both%20the%20Internal%20Notes%20and%20the%20Ticket%20Thread%20as%20Default%20in%20osTicket%201.6%20ST" id="wpa2a_20"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2011/09/04/how-to-collapse-both-the-internal-notes-and-the-ticket-thread-as-default-in-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
