
var CAPTION_CONTENTS='Contents';var CAPTION_DOCUMENT='Document';var CAPTION_LABEL='Label';var CAPTION_PREVIEW='Preview';var FIELD_CONTENTS='contents';var FIELD_NAMES='names';var MAX_LEN_ID=32;var MAX_LEN_NAME=128;

function PageTextContent(elementId,contentName,contentId,editorHeight)
{this.elementId=elementId;this.contentName=contentName;this.editorHeight=editorHeight;this.contentId=contentId;}
function PageTextValue(id,name,revision,contents,creatorId,createdDate,lastModifierId,lastModifiedDate)
{this.id=id;this.name=name;this.revision=revision;this.contents=contents;this.creatorId=creatorId;this.createdDate=createdDate;this.lastModifierId=lastModifierId;this.lastModifiedDate=lastModifiedDate;}

function PinkContentCalls(rootPath)
{if(undefined==rootPath)
this.rootPath='/content';else
this.rootPath=rootPath;this.servicePath=this.rootPath+'/ajax';this.cdataElements=new Array();this.cdataElements[FIELD_NAME]=FIELD_NAME;this.cdataElements[FIELD_CONTENTS]=FIELD_CONTENTS;this.modules=new Array();}
PinkContentCalls.prototype=new AjaxHelper();PinkContentCalls.prototype.canAuthor=function()
{return this.synchCall(this.servicePath+'/canAuthor.json').payload;}
PinkContentCalls.prototype.getAuditPageDocUrl=function(id)
{var queryString='';queryString=this.toQueryString(queryString,FIELD_ID,id);return this.servicePath+'/member/viewAuditPageDoc'+queryString;}
PinkContentCalls.prototype.getAuditPageDocWorklist=function(filter,callback)
{this.asynchPostMap(this.servicePath+'/member/getAuditPageDocWorklist.json',filter,callback);}
PinkContentCalls.prototype.getAuditPageText=function(id,callback)
{this.asynchPostMap(this.servicePath+'/member/getAuditPageText.json',{id:id},callback);}
PinkContentCalls.prototype.getAuditPageTextWorklist=function(criteria,callback)
{this.asynchPostMap(this.servicePath+'/member/getAuditPageTextWorklist.json',criteria,callback);}
PinkContentCalls.prototype.getGlossaryItem=function(id,callback)
{var url=this.servicePath+'/getGlossaryItem.json';var params={id:id};if(undefined==callback)
return this.synchPostMap(url,params);this.asynchPostMap(url,params,callback);}
PinkContentCalls.prototype.getGlossaryList=function(callback)
{this.asynchCall(this.servicePath+'/getGlossaryList.json',callback);}
PinkContentCalls.prototype.getPageDoc=function(id,name,callback)
{var url=this.servicePath+'/getPageDoc.json';var params={id:id,name:name};if(undefined==callback)
return this.synchPostMap(url,params);this.asynchPostMap(url,params,callback);}
PinkContentCalls.prototype.getPageDocUrl=function(id,name)
{var queryString='';queryString=this.toQueryString(queryString,FIELD_ID,id);queryString=this.toQueryString(queryString,FIELD_NAME,name);return this.rootPath+'/doc'+queryString;}
PinkContentCalls.prototype.getPageDocNames=function(name,pageSize,callback)
{var url=this.servicePath+'/member/getPageDocNames.json';var params={name:name,pageSize:pageSize};if(undefined==callback)
return this.synchPostMap(url,params);this.asynchPostMap(url,params,callback);}
PinkContentCalls.prototype.getPageText=function(id,name,callback)
{var url=this.servicePath+'/getPageText.json';var params={id:id,name:name};if(undefined==callback)
return this.synchPostMap(url,params);this.asynchPostMap(url,params,callback);}
PinkContentCalls.prototype.getPageTextNames=function(name,pageSize,callback)
{var url=this.servicePath+'/member/getPageTextNames.json';var params={name:name,pageSize:pageSize};if(undefined==callback)
return this.synchPostMap(url,params);this.asynchPostMap(url,params,callback);}
PinkContentCalls.prototype.loadAdminModule=function()
{this.loadModule('/common/scripts/dropdown.js');this.loadModule(this.rootPath+'/scripts/admin.js');}
PinkContentCalls.prototype.loadModule=function(url)
{if(this.modules[url])
return false;;var head=document.getElementsByTagName('head')[0];var elem=document.createElement('script');elem.type='text/javascript';elem.src=url;head.appendChild(elem);return(this.modules[url]=true);}
PinkContentCalls.prototype.rollbackDoc=function(id)
{return this.synchPostMap(this.servicePath+'/member/rollbackDoc.json',{id:id});}
PinkContentCalls.prototype.setGlossary=function(value,callback)
{this.asynchPostMap(this.servicePath+'/member/setGlossary.json',this.convertAll(value),callback);}
PinkContentCalls.prototype.setPageDocUrl=function()
{return this.servicePath+'/member/setPageDoc.txt';}
PinkContentCalls.prototype.setPageText=function(value,callback)
{this.asynchPostMap(this.servicePath+'/member/setPageText.json',this.convertAll(value),callback);}
PinkContentCalls.prototype.swapGlossaryOrder=function(firstId,secondId)
{return this.synchPostMap(this.servicePath+'/member/swapGlossaryOrder.json',{firstId:firstId,secondId:secondId});}
function PinkContentDataHandler(body){this.body=body;}
PinkContentDataHandler.prototype.handleRequestData=function(value)
{if((undefined!=value)&&(undefined!=value.contents))
this.body.innerHTML=value.contents;}
