[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Smarty/templates/Settings/ -> PickList.tpl (source)

   1  {*<!--
   2  /*********************************************************************************
   3    ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4     * ("License"); You may not use this file except in compliance with the License
   5     * The Original Code is:  vtiger CRM Open Source
   6     * The Initial Developer of the Original Code is vtiger.
   7     * Portions created by vtiger are Copyright (C) vtiger.
   8     * All Rights Reserved.
   9    *
  10   ********************************************************************************/
  11  -->*}
  12  <script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
  13  <script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
  14  <script src="include/scriptaculous/prototype.js" type="text/javascript"></script>
  15  <script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
  16  <script>
  17  {literal}
  18  function splitvalues() {
  19      var picklistobj=getobj("listarea")
  20      var picklistcontent=picklistobj.value
  21      var picklistary=new array()
  22      var i=0;
  23      
  24      //splitting up of values
  25      if (picklistcontent.indexof("\n")!=-1) {
  26          while(picklistcontent.indexof("\n")!=-1) {
  27              if (picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
  28                  picklistary[i]=picklistcontent.substr(0,picklistcontent.indexof("\n")).replace(/^\s+/g, '').replace(/\s+$/g, '')
  29                  picklistcontent=picklistcontent.substr(picklistcontent.indexof("\n")+1,picklistcontent.length)
  30                  i++
  31              } else break;
  32          }
  33      } else if (picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
  34          picklistary[0]=picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '')
  35      }
  36      
  37      return picklistary;
  38  }
  39  function setdefaultlist() {
  40      var picklistary=new array()
  41      picklistary=splitvalues()
  42      
  43      getobj("defaultlist").innerhtml=""
  44      
  45      for (i=0;i<picklistary.length;i++) {
  46          var objoption=document.createelement("option")
  47          if (browser_ie) {
  48              objoption.innertext=picklistary[i]
  49              objoption.value=picklistary[i]
  50          } else if (browser_nn4 || browser_nn6) {
  51              objoption.text=picklistary[i]
  52              objoption.setattribute("value",picklistary[i])
  53          }
  54      
  55          getobj("defaultlist").appendchild(objoption)
  56      }
  57  }
  58  function validate() {
  59      if (emptycheck("listarea","picklist values"))    {
  60          var picklistary=new array()
  61          picklistary=splitvalues()
  62          //empty check validation
  63          for (i=0;i<picklistary.length;i++) {
  64              if (picklistary[i]=="") {
  65                  alert("picklist value cannot be empty")
  66                  picklistobj.focus()
  67                  return false
  68              }
  69          }
  70  
  71          //duplicate values' validation
  72          for (i=0;i<picklistary.length;i++) {
  73              for (j=i+1;j<picklistary.length;j++) {
  74                  if (picklistary[i]==picklistary[j]) {
  75                      alert("duplicate values found")
  76                      picklistobj.focus()
  77                      return false
  78                  }
  79              }
  80          }
  81  
  82          return true;
  83      }
  84  }
  85  
  86  {/literal}
  87  </script>
  88  <br>
  89  <table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
  90  <tbody><tr>
  91          <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
  92          <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
  93  <br>
  94      <div align=center>
  95      
  96              {include file='SetMenu.tpl'}
  97                  <!-- DISPLAY -->
  98                  <table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
  99                  <tr>
 100                      <td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}picklist.gif" width="48" height="48" border=0 ></td>
 101                      <td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > {$MOD.LBL_PICKLIST_EDITOR}</b></td>
 102                  </tr>
 103                  <tr>
 104                      <td valign=top class="small">{$MOD.LBL_PICKLIST_DESCRIPTION}</td>
 105                  </tr>
 106                  </table>
 107                  
 108                  
 109                  <table border=0 cellspacing=0 cellpadding=10 width=100% >
 110                  <tr>
 111                  <td valign=top>
 112                  
 113                      <table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
 114                      <tr>
 115                          <td class="big"><strong>1. {$MOD.LBL_SELECT_MODULE}</strong></td>
 116                          <td class="small" align=right>&nbsp;</td>
 117                      </tr>
 118                      </table>
 119                      <table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
 120                          <tr class="small">
 121                              <td width="35%" class="small cellLabel"><strong>{$MOD.LBL_SELECT_CRM_MODULE}</strong></td>
 122                              <td width="65%" class="cellText" >
 123                      <select name="pickmodule" class="detailedViewTextBox" onChange="changeModule(this);">
 124                      {foreach key=tabid item=module from=$MODULE_LISTS}
 125                          <option value="{$module}">{$APP.$module}</option>
 126                      {/foreach}
 127                      </select>
 128                  </td>
 129                        </tr>
 130                      </table>
 131                      <br>
 132                  <table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
 133                  <tr>
 134                      <td class="big" rowspan="2">
 135                      <div id="picklist_datas">    
 136                          {include file='Settings/PickListContents.tpl'}
 137                      </div>
 138                      </td>    
 139                  </td>
 140                  </tr>
 141                      </table>
 142                  <table border=0 cellspacing=0 cellpadding=5 width=100% >
 143                      <tr><td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td></tr>
 144                  </table>
 145                  
 146                  </td>
 147                  </tr>
 148                  </table>
 149              
 150              
 151              
 152              </td>
 153              </tr>
 154              </table>
 155          </td>
 156      </tr>
 157      </table>
 158          
 159      </div>
 160  
 161  </td>
 162          <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
 163     </tr>
 164  </tbody>
 165  </table>
 166  <div id="editdiv" style="display:block;position:absolute;width:510px;"></div>
 167  {literal}
 168  <script>
 169  function SavePickList(fieldname,module,uitype)
 170  {
 171      $("status").style.display = "inline";
 172      Effect.Puff($('editdiv'),{duration:2});
 173      var body = escape($("picklist_values").value);
 174  
 175      new Ajax.Request(
 176              'index.php?action=SettingsAjax&module=Settings&directmode=ajax&file=UpdateComboValues&table_name='+fieldname+'&fld_module='+module+'&listarea='+body+'&uitype='+uitype,
 177              {queue: {position: 'end', scope: 'command'},
 178                  method: 'get',
 179                  postBody: null,
 180                  /* postBody: 'action=SettingsAjax&module=Settings&directmode=ajax&file=UpdateComboValues&table_name='+fieldname+'&fld_module='+module+'&listarea='+body, */
 181                  onComplete: function(response) {
 182                      $("status").style.display="none";
 183                          $("picklist_datas").innerHTML=response.responseText;
 184                              }
 185              }
 186      );
 187  }
 188  function changeModule(pickmodule)
 189  {
 190      $("status").style.display="inline";
 191      var module=pickmodule.options[pickmodule.options.selectedIndex].value;
 192      new Ajax.Request(
 193                  'index.php',
 194                  {queue: {position: 'end', scope: 'command'},
 195                          method: 'post',
 196                          postBody: 'action=SettingsAjax&module=Settings&directmode=ajax&file=PickList&fld_module='+module,
 197                          onComplete: function(response) {
 198                                          $("status").style.display="none";
 199                                          $("picklist_datas").innerHTML=response.responseText;
 200                                  }
 201                  }
 202          );
 203  }
 204  function fetchEditPickList(module,fieldname,uitype)
 205  {
 206      $("status").style.display="inline";
 207      new Ajax.Request(
 208                  'index.php',
 209                  {queue: {position: 'end', scope: 'command'},
 210                          method: 'post',
 211                          postBody: 'action=SettingsAjax&module=Settings&mode=edit&file=EditComboField&fld_module='+module+'&fieldname='+fieldname+'&uitype='+uitype,
 212              onComplete: function(response) {
 213                                          $("status").style.display="none";
 214                                          $("editdiv").innerHTML=response.responseText;
 215                      Effect.Grow('editdiv');
 216                      }
 217                  }
 218          );
 219  }
 220  
 221  function picklist_validate(mode,fieldname,module,uitype)
 222  {
 223      
 224      //alert(trim($("picklist_values").value));
 225      
 226      var pick_arr=new Array();
 227      pick_arr=trim($("picklist_values").value).split('\n');    
 228      var len=pick_arr.length;
 229      for(i=0;i<len;i++)
 230      {
 231          var valone;
 232          curr_iter = i;
 233          valone=pick_arr[curr_iter];
 234          for(j=curr_iter+1;j<len;j++)
 235          {
 236              var valnext;
 237              valnext=pick_arr[j];
 238              if(trim(valone) == trim(valnext))
 239              {
 240                  alert("Duplicate entries found for the value '"+valone+"'");
 241                  return false;
 242              }
 243          }
 244          i = curr_iter        
 245  
 246      }
 247      if(mode == 'edit')
 248      {
 249          if(trim($("picklist_values").value) == '')
 250          {
 251              alert("Picklist value cannot be empty");
 252              $("picklist_values").focus();    
 253              return false;
 254          }
 255      }
 256      SavePickList(fieldname,module,uitype)    
 257  }
 258  </script>
 259  {/literal}


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7