This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - When aras call Viewer , I need adding Print Role checking routine ..

nambright - Wednesday, February 16, 2011 8:59 PM:

// Problem :
// When aras call Viewer , I need adding Print Role checking routine ..
//  -_-;;  but it' cannot edit Load Viewer Method ...

logged In as Administrator...! 

Menu Path : Administrator> Form Events > File > Load Viewer

and I try  Lock Item  to edit  ..

but  ,

message :

 You have insufficient permissions to lock the item.You have insufficient permissions to lock the item.

 ItemMethods: LockItem: You don't have permission to lock item.

I cannot edit  Load Viewer Method  !!
How  can I edit Load Viewer Method or anoother EASY way  "When aras call Viewer , adding Print Role checking routine" ?


-------------------------------------------
/*version:11*/
document.body.scroll = "no";

var item = document.item;
if (!item) return;

if (top.aras.isTempEx(item)) return;

with (top.aras)
{
  var filename = getItemProperty(item, 'filename');
  if (filename != '')
  {
    var fileURL = getFileURLEx(item);
    if (!fileURL) return;
   
    var fileTypeId = getItemProperty(item, 'file_type');
    var fileType   = getItemFromServerWithRels('FileType',fileTypeId,'name','View With','related_id(viewer_url)',1).node;

    var viewer  = (fileType) ? fileType.selectSingleNode('Relationships/Item/related_id/Item/viewer_url') : null;

//edit from her ..  
 //added :  User's print  Role check here !!!
    var PrintRole = getItemProperty(item, 'PrintRole');

    var PrintURL=''; //will Add URL text 

    if (viewer)
     { 
            if (PrintRole == 'Print' )
           {
                 PrintURL='Print';
            }
           else
          {
                PrintURL='NoPrint';
           }        
         document.location.replace(scriptsURL + viewer.text + '?file_url=' + escape(fileURL)+'&Print='+PrintURL );

          // now , added parameter to URL ^^;   // viewer will handle this ...  or not , it;'s  doesn't metter... 

      //document.location.replace(scriptsURL + viewer.text + '?file_url=' + escape(fileURL));
 //edit to her .. 

    }
    else if (fileType)
    {
      top.aras.uiNavigateWindowWithUserCredentials(top.window, fileURL);
    }
    else
    {
      var spnId = 'file_form_message';
      var spn = document.getElementById(spnId);
      if (spn)
      {
        var newMessageHtml = '' +
         '<table width="410" cellpadding="3" cellspacing="5">' +
         '  <tr>' +
         '    <td align="left" valign="middle" width="360">' +
         '      <h1 style="COLOR:000000; FONT: 13pt/15pt verdana">' +
                  getResource('', 'imports_core.file_extension_troubles') +
         '      </h1>' +
         '    </td>' +
         '  </tr>' +
         '  <tr>' +
         '    <td width="400" colspan="2">' +
         '      <font style="COLOR:000000; FONT: 8pt/11pt verdana">' +
                  getResource('', 'imports_core.file_extension_troubles_use_file_download') +
         '      </font>' +
         '    </td>' +
         '  </tr>' +
         '</table>';
        spn.innerHTML = newMessageHtml;
      }     
    }
  }
}


 ^^;;  from  Seoul ,Korea ..

  



SamsAn - Thursday, February 17, 2011 2:58 PM:

Hi.

Login as "root" into Innovator and edit the method under this account. This method has special private permissions restricting "Update" operation for you. But no permissions are applied for root at all.

SamsAn.



nambright - Thursday, February 17, 2011 8:28 PM:

Thanks you  very much .. ^^ ;;